-
Notifications
You must be signed in to change notification settings - Fork 0
How Do I Port Mithril 0.x to 1.x
You have a code-base written for Mithril 0.x. Now you want to port that to Mithril 1.x.
There is a lot of information covered in the Migration Page. Also read Mithril Migration Path.
You can at least automate about half of the migration issue with Mithril Codemods. You will still need to deal with the rest by hand.
-
Controllers will have to be reworked, this needs your understanding of the Lifecycle Methods concept. Especially important is the state that goes with vnode. That's where you hook up your controller/service code.
-
In Typescript Component and Vnode are parametrized with <State, Attrib> therefore, your Controller class can go in there or it can be a member of another class that defines the State class. Attrib's main purpose is to serve as a data structure class that will be passed to a component when you are instantiating it. If you do not have an appropriate class for either of those, supply <any, any> or <{}, {}>.
-
prop is now renamed to stream() and it is also a different "module", in the system although functionally equivalent.
If you alias stream back into prop like;
import prop = stream;
You probably do not need to alter a lot of your Typescript code.
This open source product is provided under the terms of the MIT License.