1 | import { Disposable } from './disposable';
|
2 |
|
3 |
|
4 |
|
5 | export interface Event<T> {
|
6 | |
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | (listener: (e: T) => any, thisArgs?: any, disposables?: Disposable[]): Disposable;
|
14 | }
|
15 | export declare namespace Event {
|
16 | const None: Event<any>;
|
17 | }
|
18 | export interface EmitterOptions {
|
19 | onFirstListenerAdd?: Function;
|
20 | onLastListenerRemove?: Function;
|
21 | }
|
22 | export declare class Emitter<T> {
|
23 | private _options?;
|
24 | private static _noop;
|
25 | private _event;
|
26 | private _callbacks;
|
27 | constructor(_options?: EmitterOptions | undefined);
|
28 | /**
|
29 | * For the public to allow to subscribe
|
30 | * to events from this Emitter
|
31 | */
|
32 | get event(): Event<T>;
|
33 | /**
|
34 | * To be kept private to fire an event to
|
35 | * subscribers
|
36 | */
|
37 | fire(event: T): any;
|
38 | dispose(): void;
|
39 | }
|