import { Resolvable } from '.'; /** * A no-operation function that acts as the rejection handler of a promise. */ export declare function bear(_error: any): undefined; /** * Create a promise that will be fulfilled in given duration (milliseconds). * @param duration Duration in milliseconds before the promise gets fulfilled. */ export declare function sleep(duration: number): Promise; export declare type RetryHandler = (lastReason: any, attempts: number) => Resolvable; export interface RetryOptions { /** Try limit times (defaults to 3). */ limit?: number; /** Interval between two tries (defaults to 0). */ interval?: number; } /** * Retry procedure in the handler for several times. * @param handler Retry handler. * @param options Retry options. * @return Created promise. */ export declare function retry(handler: RetryHandler, options?: RetryOptions): Promise; export declare type BatchSchedulerHandler = (tasks: T[]) => Resolvable; /** * BatchScheduler provides the ability to handle tasks scheduled within a time * span in batch. */ export declare class BatchScheduler { private handler; private timeBeforeStart; private tasks; private batchPromise; /** * Construct a BatchScheduler instance. * * @param handler A batch handler for the tasks put together. * @param timeBeforeStart The time span within which tasks would be handled * in batch. */ constructor(handler: BatchSchedulerHandler, timeBeforeStart?: number | undefined); /** Schedule a task. */ schedule(task: T): Promise; }