UNPKG

puppeteer-core

Version:

A high-level API to control headless Chrome over the DevTools Protocol

30 lines • 965 B
import { TimeoutError } from '../common/Errors.js'; /** * @internal */ export interface DeferredOptions { message: string; timeout: number; } /** * Creates and returns a deferred object along with the resolve/reject functions. * * If the deferred has not been resolved/rejected within the `timeout` period, * the deferred gets resolves with a timeout error. `timeout` has to be greater than 0 or * it is ignored. * * @internal */ export declare class Deferred<T, V extends Error = Error> { #private; constructor(opts?: DeferredOptions); resolve(value: T): void; reject(error: V | TimeoutError): void; resolved(): boolean; finished(): boolean; value(): T | V | TimeoutError | undefined; valueOrThrow(): Promise<T>; static create<R, X extends Error = Error>(opts?: DeferredOptions): Deferred<R>; static race<R>(awaitables: Array<Promise<R> | Deferred<R>>): Promise<R>; } //# sourceMappingURL=Deferred.d.ts.map