Skip to content

Instantly share code, notes, and snippets.

@Naddiseo
Created April 26, 2017 19:21
Show Gist options
  • Save Naddiseo/bb7e312aa34c59589a24a21f80835ebd to your computer and use it in GitHub Desktop.
Save Naddiseo/bb7e312aa34c59589a24a21f80835ebd to your computer and use it in GitHub Desktop.
function Ctrl(data) {
function onClick(field, id, el) {}
this.handlers = data.map(function (datum, id) { return OnClick.bind(null, datum, id); });
this.data = data;
}
function View(ctrl) {
return ctrl.data.map(function(datum, id) {
return m('input', { onchange: ctrl.handlers[id] }, ...);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment