Skip to content

Instantly share code, notes, and snippets.

@pelonpelon
Created April 29, 2015 22:16
Show Gist options
  • Save pelonpelon/bd07b3b76ce70b580639 to your computer and use it in GitHub Desktop.
Save pelonpelon/bd07b3b76ce70b580639 to your computer and use it in GitHub Desktop.
Mithril component inheritance - credit: Gilbert (https://github.com/mindeavor)
m.initComponent = function (component, options, content) {
var controller = new component.controller(options)
controller.render = function (options2, content2) {
return component.view(controller, options2 || options, content2 || content)
}
return controller
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment