UNPKG

ste-promise-signals

Version:

Add the power of Promise Signals to your projects. They are the most bare bones implementation of an event that supports promises.

31 lines (30 loc) 1.02 kB
import { IPropagationStatus, PromiseDispatcherBase } from 'ste-core'; import { IPromiseSignal } from './IPromiseSignal'; import { IPromiseSignalHandler } from './IPromiseSignalHandler'; /** * The dispatcher handles the storage of subsciptions and facilitates * subscription, unsubscription and dispatching of a signal event. */ export declare class PromiseSignalDispatcher extends PromiseDispatcherBase<IPromiseSignalHandler> implements IPromiseSignal { /** * Creates a new SignalDispatcher instance. */ constructor(); /** * Dispatches the signal. * * @returns {IPropagationStatus} The status of the dispatch. * * @memberOf SignalDispatcher */ dispatch(): Promise<IPropagationStatus>; /** * Dispatches the signal threaded. */ dispatchAsync(): void; /** * Creates an event from the dispatcher. Will return the dispatcher * in a wrapper. This will prevent exposure of any dispatcher methods. */ asEvent(): IPromiseSignal; }