/** * @module * Provides `PromiseLike` that can be resolved from outside. * @see {@link IConfigurablePromiseLike} * @see {@link PromiseResolutionSource} */ /** * Represents a `PromiseLike` that supports further configuration, * such as to explicitly execute callbacks asynchronously. */ export interface IConfigurablePromiseLike extends PromiseLike { /** * Gets a `PromiseLike` that ensures the {@link PromiseLike.then} callbacks * are executed asynchronously. * * @remarks executing the callbacks asynchronsouly may let lose the current execution context, * such as going out of an event handler, or an `requestAnimationFrame` callback. */ forceAsync(): PromiseLike; } /** * Resolves or rejects a `PromiseLike` from outside of it. * * This class is significantly different from {@link PromiseResolutionSource} * in the way that it ensures when {@link tryResolve}, {@link tryCancel}, or {@link tryReject} * is called, the continuation callbacks associated with `PromiseLike` are executed *synchronously*. * However, downstream consumers are still able to let their continuation callbacks execute asynchronously. * See {@link IConfigurablePromiseLike} for more information. * * This class is similar to `Deferred` but it explicitly separates * the promise and its control side into two different objects. * * @typeparam T type of the promise resolution result. */ export declare class PromiseLikeResolutionSource { private _promiseLike; private _ensurePromiseLikeInitialized; /** Gets the derived `PromiseLike` controlled by the current instance. */ get promiseLike(): IConfigurablePromiseLike; /** * Synchronously resolves the derived `PromiseLike` with the specified result. * @param result the resolution result, or a `PromiseLike` that can be further *resolved*. * @returns `true` if the derived `PromiseLike` has just been *resolved*; * otherwise it means the `PromiseLike` has already been *settled* before. */ tryResolve(result: T | PromiseLike): boolean; /** * Synchronously cancels the derived `PromiseLike`. * @returns `true` if the derived `PromiseLike` has just been *rejected* with `PromiseCancelledError`; * otherwise it means the `PromiseLike` has already been *settled* before. */ tryCancel(): boolean; /** * Synchronously rejects the derived `PromiseLike` with the specified rason. * @param reason the rejection reason, or the `Error` causing the rejection. * @returns `true` if the derived `PromiseLike` has just been *rejected*; * otherwise it means the `PromiseLike` has already been *settled* before. */ tryReject(reason: any): boolean; } //# sourceMappingURL=promiseLikeResolutionSource.d.ts.map