mirror of
https://github.com/flarum/core.git
synced 2025-08-08 17:36:38 +02:00
Add documentation for withAttr util
This commit is contained in:
committed by
Franz Liedke
parent
376a00f24f
commit
b8abd2522e
@@ -1,3 +1,10 @@
|
|||||||
|
/**
|
||||||
|
* An event handler factory that makes it simpler to implement data
|
||||||
|
* binding for component event listeners.
|
||||||
|
*
|
||||||
|
* Replaces m.withAttr for mithril 2.0
|
||||||
|
* @see https://mithril.js.org/archive/v0.2.5/mithril.withAttr.html
|
||||||
|
*/
|
||||||
export default (key: string, cb: Function) =>
|
export default (key: string, cb: Function) =>
|
||||||
function (this: Element) {
|
function (this: Element) {
|
||||||
cb(this.getAttribute(key) || this[key]);
|
cb(this.getAttribute(key) || this[key]);
|
||||||
|
Reference in New Issue
Block a user