Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

Awesome Lists containing this project

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.js

var 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);
```