@smui/common
Version:
Svelte Material UI - Common
25 lines (24 loc) • 895 B
TypeScript
/**
* A way to keep track of things you've "on"ed so you can "off" them too.
*
* This is needed because Svelte doesn't have an "off" function, it returns
* unlisten functions from its "on" function, and MDC-Web expects register and
* deregister functions in the adapters.
*/
export declare class SvelteEventManager {
elementMap: Map<Element | Window | Document, {
[k: string]: Map<Function, Function>;
}>;
/**
* Listen to an event on an element.
*/
on<T extends Event>(element: Element | Window | Document, event: string, handler: (evt: T) => void, options?: AddEventListenerOptions): void;
/**
* Unlisten to an event on an element.
*/
off<T extends Event>(element: Element | Window | Document, event: string, handler: (evt: T) => void): void;
/**
* Unlisten to all events managed by this instance.
*/
clear(): void;
}