Patch Mithril with a bidi attribute

Enables quick bidirectional bindings. So instead of this:

<input value={prop()} oninput={m.withAttr('value', prop)}/>

... we can do this:

<input bidi={prop}/>
This commit is contained in:
Toby Zerner
2015-09-18 13:06:37 +09:30
parent 1fc369c59e
commit 0b406a06a1
4 changed files with 12 additions and 3 deletions

View File

@ -8,8 +8,14 @@ export default function patchMithril(global) {
return comp.component(...args);
}
return mo.apply(this, arguments);
}
const node = mo.apply(this, arguments);
if (node.attrs.bidi) {
m.bidi(node, node.attrs.bidi);
}
return node;
};
Object.keys(mo).forEach(key => m[key] = mo[key]);