Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/activitystream/mithril-migrate
A utility for running mithril 1.0 code inside mithril 0.2.x applications
https://github.com/activitystream/mithril-migrate
Last synced: 3 months ago
JSON representation
A utility for running mithril 1.0 code inside mithril 0.2.x applications
- Host: GitHub
- URL: https://github.com/activitystream/mithril-migrate
- Owner: activitystream
- License: mit
- Created: 2016-09-22T13:36:00.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-09-29T14:27:43.000Z (over 8 years ago)
- Last Synced: 2024-07-02T14:48:49.355Z (7 months ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 2
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - mithril-migrate - A utility for running mithril 1.0 code inside mithril 0.2.x applications (JavaScript)
README
# Usage
```javascript
// app.js
var m = require('mithril');
var mithril1 = require('mithril1'); // or however you want
var migrate = require('mithril-migrate');migrate.m = m;
migrate.m1 = mithril1;var myComponent = require('./mycomponent.js');
m.mount(document.body, {
view: function(){
return m('.container', [
m(myComponent)
])
}
})
``````javascript
// mycomponent.jsvar m = require('mithril1'); // or however you load mithril v1 into your app
var migrate = require('mithril-migrate');var myComponent = {
oninit: function(){
console.log('intializing mithril 1.0 component inside 0.2');
},
view: function(vnode) {
return m('h1', 'success')
}
}module.exports = migrate(myComponent);
```