UNPKG

custom-listenable

Version:

Create custom listenable with addListener and removeListener methods.

9 lines (8 loc) 327 B
export type ListenerOptions = { once?: boolean; }; export declare const listenable: <CallbackData = unknown>() => { addListener: (callback: (data: CallbackData) => void, options?: ListenerOptions) => void; removeListener: (callback: (data: CallbackData) => void) => void; emit: (data: CallbackData) => void; };