/** * Copyright 2020 Angus.Fenying * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { RawPromise } from './class.RawPromise'; export declare type ITimeoutResult = { 'error': null; 'value'?: T; } | { 'error': E; 'value': void; }; export declare type IPromiseTimeoutResultHandler = (result: ITimeoutResult) => void; /** * A promise controllation with timeout. * * @deprecated Use `@litert/observable` instead. And this class will be removed in v2.0.0 version. */ export declare class TimeoutPromise extends RawPromise { private _timer; private _msTimeout; private _timeoutError; private _handleTimeout; private _reject; private _resolve; /** * The constructor of a timeout-promise. * * @param msTimeout The timeout in milliseconds. * @param timeoutError The error object to be thrown if timeout * @param autoStart Start the timer immediately. * @param handleTimeout Inject a handler to receiver the result after timeout. * * @deprecated Use `@litert/observable` instead. And this class will be removed in v2.0.0 version. */ constructor(msTimeout: number, timeoutError: E, autoStart?: boolean, handleTimeout?: IPromiseTimeoutResultHandler); private _initMethods; /** * Start the timer. */ start(): void; } //# sourceMappingURL=class.TimeoutPromise.d.ts.map