zeebe-node
Version:
The Node.js client library for the Zeebe Workflow Automation Engine.
17 lines (16 loc) • 752 B
TypeScript
declare type EventMap = Record<string, any>;
declare type EventKey<T extends EventMap> = string & keyof T;
declare type EventReceiver = () => void;
interface Emitter<T extends EventMap> {
on<K extends EventKey<T>>(eventName: K, fn: EventReceiver): void;
off<K extends EventKey<T>>(eventName: K, fn: EventReceiver): void;
emit<K extends EventKey<T>>(eventName: K, params?: T[K]): void;
}
export declare class TypedEmitter<T extends EventMap> implements Emitter<T> {
private emitter;
on<K extends EventKey<T>>(eventName: K, fn: EventReceiver): this;
off<K extends EventKey<T>>(eventName: K, fn: EventReceiver): void;
emit<K extends EventKey<T>>(eventName: K, params?: T[K]): void;
removeAllListeners(): void;
}
export {};