@lifaon/rx-js-light
Version:
Blazing fast Observables
27 lines (26 loc) • 1.42 kB
TypeScript
import { IPromiseFactory } from '../promise-factory.type';
export interface IOnFulfilled<GValue> {
(value: GValue): void;
}
export interface IOnRejected {
(error: any): void;
}
export interface IOnAborted {
(): void;
}
/**
* Awaits that the promise is resolved or aborted and calls the proper callback
*/
export declare function awaitPromiseFactoryWithAbortSignal<GValue>(promiseFactory: IPromiseFactory<GValue>, signal: AbortSignal, onFulfilled: IOnFulfilled<GValue>, onRejected: IOnRejected, onAborted: IOnAborted): void;
/**
* Awaits that the promise is resolved or aborted and calls the proper callback
*/
export declare function awaitPromiseWithAbortSignal<GValue>(promise: Promise<GValue>, signal: AbortSignal, onFulfilled: IOnFulfilled<GValue>, onRejected: IOnRejected, onAborted: IOnAborted): void;
export declare function abortSignalPromiseBranching<GValue>(signal: AbortSignal, promiseFactoryNotAborted: IPromiseFactory<GValue>, promiseFactoryAborted?: IPromiseFactory<GValue>): Promise<GValue>;
/**
* Wraps a promise factory with an AbortSignal:
* - if aborted, returns a rejected promise
* - else returns the promise
*/
export declare function wrapPromiseFactoryWithAbortSignal<GValue>(promiseFactory: IPromiseFactory<GValue>, signal: AbortSignal): Promise<GValue>;
export declare function wrapPromiseWithAbortSignal<GValue>(promise: Promise<GValue>, signal: AbortSignal): Promise<GValue>;