UNPKG

@eclipse-emfcloud/model-service-theia

Version:
15 lines 939 B
/** Protocol of the optional call-back function in the promise {@link timeout()} API. */ export type TimeoutHandler<T> = (reason: 'timeout' | T | Error) => string | undefined; /** * Wrap a promise in a timeout that will reject if the promised value * is not provided within a given number of milliseconds. * * @param promise the promise to wrap * @param an optional timeout, in milliseconds. If not specified, the default is 30 seconds * @param callback an optional call-back to be invoked on completion of the wrapped provider * either by success, failure, or timeout. If it returns a string, it will be used for the * message of the returned promise's rejection error (if applicable) */ export declare function timeout<T>(promise: Promise<T>, timeout?: number, callback?: TimeoutHandler<T>): Promise<T>; export declare function retryUntilFulfilled<T>(fn: () => Promise<T>): Promise<T>; //# sourceMappingURL=promise-util.d.ts.map