1
0
mirror of https://github.com/jaandrle/deka-dom-el synced 2024-11-23 00:59:38 +01:00
deka-dom-el/src/events.js

9 lines
338 B
JavaScript
Raw Normal View History

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);
}