mirror of
https://github.com/jaandrle/deka-dom-el
synced 2024-11-23 00:59:38 +01:00
9 lines
338 B
JavaScript
9 lines
338 B
JavaScript
|
export function listen(event, listener, options){
|
||
|
return element=> element.addEventListener(event, listener, options);
|
||
|
}
|
||
|
export function dispatch(event, detail){
|
||
|
if(typeof event === "string")
|
||
|
event= typeof detail==="undefined" ? new Event(event) : new CustomEvent(event, { detail });
|
||
|
return element=> element.dispatchEvent(event);
|
||
|
}
|