export type Unsubscribe = () => void; /** * List of valid event args given `K`. */ export type EventArg = T[K]; /** * An event emitter class we can use to manage hooks or other emittable data. * Take a type argument of shape Record * * A classified version of the MIT licensed https://robinpokorny.github.io/dead-simple/ * With some type safety inspiration from https://github.com/serviejs/events */ export declare class EventEmitter { private events; /** * Registers a listener that will be called when the named event is emitted * @returns An unsubscribe function that will turn off this listener. */ on(name: K, fn: (data: EventArg) => void): Unsubscribe; /** * Registers a listener that will be called a single time when the named event * is emitted * @returns An unsubscribe function that will turn off this listener. */ once(name: K, fn: (data: EventArg) => void): Unsubscribe; /** * Removes all event listeners for the given key * @returns void */ off(name: K): void; /** * Used to emit events to all registered hook listeners * * @private */ emit(name: K, data: EventArg): void; }