UNPKG

sub-events

Version:

Lightweight, strongly-typed events, with monitored subscriptions.

14 lines (13 loc) 497 B
import { SubEventCount, IEmitOptions } from '../dist/src'; /** * Helps supporting any custom Event-like type. */ interface IEventLike { addEventListener: (type: string, callback: (e: Event) => void) => void; removeEventListener: (type: string, callback: (e: Event) => void) => void; } /** * Creates a strongly-typed, named DOM Event wrapper. */ export declare function fromEvent<T extends Event>(target: IEventLike, event: string, options?: IEmitOptions): SubEventCount<T>; export {};