@difizen/mana-observable
Version:
28 lines • 899 B
TypeScript
import type { Event } from '@difizen/mana-common';
import { Emitter } from '@difizen/mana-common';
import { CallbackList } from '@difizen/mana-common';
type Callback = (...args: any[]) => any;
export declare class AsyncCallbackList extends CallbackList {
protected called: Callback[] | undefined;
invoke(...args: any[]): any[];
}
export type EmitterOptions = {
onFirstListenerAdd?: (ctx: any) => void;
onLastListenerRemove?: (ctx: any) => void;
};
export declare class AsyncEmitter<T = any> extends Emitter {
protected _asyncCallbacks: CallbackList | undefined;
protected _eventAsync?: Event<T>;
/**
* For the public to allow to subscribe
* to events from this Emitter
*/
get eventAsync(): Event<T>;
/**
* fire an event to subscribers
*/
fire(event: T): any;
dispose(): void;
}
export {};
//# sourceMappingURL=async-event.d.ts.map