improve prevent default event when replay

This commit is contained in:
Yanzhen Yu
2026-04-01 12:00:00 +08:00
parent 3e1ef6825e
commit 20f27a3822
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;
}