/** * @module * Contains common utility functions for `Promise`. */ /** */ import { ICancellationToken } from "./primitives/cancellation"; /** * Gets a `Promise` that resolves after the specified time of delay. * @param milliseconds non-negative time in milliseconds to wait before the returned `Promise` resolves. * @param cancellationToken a token used to cancel the returned `Promise`. * @see {@link yielded} * @todo make this function also works in nodejs. */ export declare function delay(milliseconds: number, cancellationToken?: ICancellationToken): Promise; /** * Returns a `PromiseLike` instance that, when used with `await` expression, * asynchronously yields back to the code below. The instance returned behaves * like the returned value of `Promise.resolve()`. * * Note: The major difference between `yielded()` and `delay(0)`, is that `delay` will * resolve the returned `Promise` in a `setTimeout` callback, even if the delay time is `0`. * This will cause `Promise` returned by `delay` be *resolved* in marcoTask queue on some execution engine. * * @see {@link delay} */ export declare function yielded(): PromiseLike; /** * Gets a resolved `Promise`. * This function behaves the same as `Promise.resolve`. * @param result the result of the resolved `Promise`. */ export declare function fromResolved(result: T | PromiseLike): Promise; /** * Gets a rejected `Promise`. * This function behaves the same as `Promise.reject`. * @param reason the rejection reason, or the `Error` causing the rejection. */ export declare function fromRejected(reason: any): Promise; /** * Gets a cancelled `Promise`. * * A cancelled `Promise` is a `Promise` rejected with {@link PromiseCancelledError}. */ export declare function fromCancelled(): Promise; //# sourceMappingURL=common.d.ts.map