@deephaven/golden-layout
Version:
A multi-screen javascript Layout manager
59 lines • 1.84 kB
TypeScript
/**
* A generic and very fast EventEmitter
* implementation. On top of emitting the
* actual event it emits an
*
* EventEmitter.ALL_EVENT
*
* event for every event triggered. This allows
* to hook into it and proxy events forwards
*
* @constructor
*/
declare class EventEmitter {
/**
* The name of the event that's triggered for every other event
*
* usage
*
* myEmitter.on( EventEmitter.ALL_EVENT, function( eventName, argsArray ){
* //do stuff
* });
*/
static ALL_EVENT: string;
private _mSubscriptions;
constructor();
/**
* Listen for events
*
* @param eventName The name of the event to listen to
* @param callback The callback to execute when the event occurs
* @param context The value of the this pointer within the callback function
*/
on(eventName: string, callback: Function, context?: unknown): void;
/**
* Emit an event and notify listeners
*
* @param eventName The name of the event
* @param args additional arguments that will be passed to the listener
*/
emit(eventName: string, ...args: unknown[]): void;
/**
* Removes a listener for an event, or all listeners if no callback and context is provided.
*
* @param eventName The name of the event
* @param callback The previously registered callback method (optional)
* @param context The previously registered context (optional)
*/
unbind(eventName: string, callback?: Function, context?: unknown): void;
/**
* Alias for unbind
*/
off: (eventName: string, callback?: Function, context?: unknown) => void;
/**
* Alias for emit
*/
trigger: (eventName: string, ...args: unknown[]) => void;
}
export default EventEmitter;
//# sourceMappingURL=EventEmitter.d.ts.map