improve prevent default event when replay

This commit is contained in:
Yanzhen Yu
2018-11-23 18:06:19 +08:00
parent 17fe17b452
commit eab30bd274
4 changed files with 42 additions and 11 deletions

23
index.d.ts vendored
View File

@@ -4,3 +4,26 @@ declare namespace mitt {
(all?: { [key: string]: Array<Handler> }): Emitter;
}
}
declare module 'delegated-events' {
type EventHandler = (event: Event) => any;
type EventListenerOptions = {
capture?: boolean;
document?: Document;
};
export function on(
name: string,
selector: string,
handler: EventHandler,
options?: EventListenerOptions,
): void;
export function off(
name: string,
selector: string,
handler: EventHandler,
options?: EventListenerOptions,
): void;
export function fire(target: EventTarget, name: string, detail?: any): void;
}