Skip to content

Instantly share code, notes, and snippets.

@maxidr
Created March 10, 2016 11:37
Show Gist options
  • Save maxidr/e4a042496b6be8457aeb to your computer and use it in GitHub Desktop.
Save maxidr/e4a042496b6be8457aeb to your computer and use it in GitHub Desktop.
void function(m) {
function closure(fn) {
var component = {
controller : function(options) {
component.view = fn(options);
}
};
return component;
}
m.mount(document.body, closure(function() {
var count = 1;
function increment() {
count++;
}
return function() {
return m("div",
count,
m("button",
{ onclick : increment },
"increment"
)
);
}
}));
}(m)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment