1
0
mirror of https://github.com/flarum/core.git synced 2025-08-08 01:16:52 +02:00

Add documentation for withAttr util

This commit is contained in:
Alexander Skvortsov
2020-08-15 20:03:03 -04:00
committed by Franz Liedke
parent 376a00f24f
commit b8abd2522e

View File

@@ -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) =>
function (this: Element) {
cb(this.getAttribute(key) || this[key]);