-
-
Save HendrikRoth/1ad564ab01e88b61d3e1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// var ListComponent = m.component({ ... }) -> component | |
// var list = ListComponent() -> component instance | |
// list.view() -> view | |
m.component = function (component) { | |
return function (options, content) { | |
var controller = new component.controller(options) | |
controller.view = function () { | |
return component.view(controller, arguments[0] || options, arguments[1] || content) | |
} | |
return controller | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ListComponent = m.component({ | |
controller: function (options) { | |
var state = {} | |
return state | |
}, | |
view: function (state) { | |
return [ | |
m('div', 'testing') | |
] | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment