Rename "handle" helper function and add noPropagate equivalent
This commit is contained in:
parent
f1932571a5
commit
7e397d8029
1 changed files with 7 additions and 1 deletions
|
@ -92,7 +92,13 @@ export class AttributeEvent extends Event {
|
||||||
* @param {function(event) : event} fn
|
* @param {function(event) : event} fn
|
||||||
* @return {function(event)}
|
* @return {function(event)}
|
||||||
*/
|
*/
|
||||||
export const handle = fn => event => { event.preventDefault(); return fn(event) }
|
export const noDefault = fn => event => { event.preventDefault(); return fn(event) }
|
||||||
|
|
||||||
|
/** Wraps an event handler in a function that calls preventDefault on the event
|
||||||
|
* @param {function(event) : event} fn
|
||||||
|
* @return {function(event)}
|
||||||
|
*/
|
||||||
|
export const noPropagate = fn => event => { event.stopPropagation(); return fn(event) }
|
||||||
|
|
||||||
|
|
||||||
/** A reference to an element that follows it around through replacements */
|
/** A reference to an element that follows it around through replacements */
|
||||||
|
|
Loading…
Reference in a new issue