ste-core
Version:
Core files for the Strongly Typed Events project.
38 lines (37 loc) • 1.26 kB
TypeScript
import { ISubscription } from "./ISubscription";
/**
* Subscription implementation for events with promises.
*
* @export
* @class PromiseSubscription
* @implements {ISubscription<TEventHandler>}
* @template TEventHandler The type of event handler.
*/
export declare class PromiseSubscription<TEventHandler> implements ISubscription<TEventHandler> {
handler: TEventHandler;
isOnce: boolean;
/**
* Indicates if the subscription has been executed before.
*
* @memberOf PromiseSubscription
*/
isExecuted: boolean;
/**
* Creates an instance of PromiseSubscription.
* @param {TEventHandler} handler The handler for the subscription.
* @param {boolean} isOnce Indicates if the handler should only be executed once.
*
* @memberOf PromiseSubscription
*/
constructor(handler: TEventHandler, isOnce: boolean);
/**
* Executes the handler.
*
* @param {boolean} executeAsync True if the even should be executed async.
* @param {*} scope The scope the scope of the event.
* @param {IArguments} args The arguments for the event.
*
* @memberOf PromiseSubscription
*/
execute(executeAsync: boolean, scope: any, args: IArguments): Promise<void>;
}