Add `$.on` vanilla JS substitute
This commit is contained in:
parent
89127aa313
commit
3b5e963da5
|
@ -0,0 +1,7 @@
|
|||
export function on(type: string, selector: string, callback: Function): void {
|
||||
document.addEventListener(type, (event: Event) => {
|
||||
if ((event.target as HTMLElement).matches(selector)) {
|
||||
callback(event);
|
||||
}
|
||||
});
|
||||
};
|
Loading…
Reference in New Issue