Skip to content

Instantly share code, notes, and snippets.

View volnei's full-sized avatar
😀

Volnei Munhoz volnei

😀
View GitHub Profile
@volnei
volnei / mithril-bind.js
Last active January 26, 2018 10:44
A mithril bind function
/**
* Use this function to bind input/select/textarea value (or other properties) to model.
* eg. m('input', {oninput: m.bind(myModel, 'property')})
* or
* eg. m('input[type=checkbox]', {onchange: m.bind('checked', myModel, 'property')}
*
* enjoy!
*/
m.bind = function(attr, obj, prop) {
if (arguments.length == 2) {