export type Listener = (event: T) => void; export type Unlisten = () => void; export type AnyListener = (type: T, event: E) => void; export type ListenerOptions = { once?: boolean; }; /** * The read side of a `Dispatcher`. Hand this out to whoever needs to react to * something; keep the dispatcher itself with whoever raises it. */ export interface Events> { on(type: K, listener: Listener, opts?: ListenerOptions): Unlisten; all(listener: AnyListener, opts?: ListenerOptions): Unlisten; }