@thenja/event-emitter
Version:
Simple class to emit and subscribe to events
12 lines (11 loc) • 399 B
TypeScript
export interface iEmittableEventsOnOptions {
uniqueId?: string;
scope?: any;
}
export declare abstract class EmittableEvents {
private events;
protected emit(eventName: string, data?: any): void;
on(eventName: string, fn: (data: any) => void, options?: iEmittableEventsOnOptions): void;
off(eventName: string, fn: ((data: any) => void) | string): void;
offAll(): void;
}