ts-simple-ast
Version:
TypeScript compiler wrapper for AST navigation and code generation.
26 lines (25 loc) • 760 B
TypeScript
/**
* Event container subscription type
*/
export declare type EventContainerSubscription<EventArgType> = (arg: EventArgType) => void;
/**
* Event container for event subscriptions.
*/
export declare class EventContainer<EventArgType = undefined> {
private readonly subscriptions;
/**
* Subscribe to an event being fired.
* @param subscription - Subscription.
*/
subscribe(subscription: EventContainerSubscription<EventArgType>): void;
/**
* Unsubscribe to an event being fired.
* @param subscription - Subscription.
*/
unsubscribe(subscription: EventContainerSubscription<EventArgType>): void;
/**
* Fire an event.
*/
fire(arg: EventArgType): void;
private getIndex(subscription);
}