import { Resolvable, Promise } from '../promise'; export declare type LockHandler = () => Resolvable; /** * `Lock` class is a useful helper that can act as a simple task queue. */ export declare class Lock { private _promise; /** * Handler will be called once the return value of previous queued handler * gets settled. * @param handler Queue handler. * @return Created promise, will be settled once the handler throws an * error or the return value of the handler gets settled. */ queue(handler: LockHandler): Promise; /** * Handler will be called if there's no queued ones. * @param handler Try handler. * @return Created promise, will be settled once the handler throws an * error or the return value of the handler gets settled. */ try(handler: LockHandler): Promise; /** * (get) A function that binds `queue` method with current instance. */ readonly queuer: (handler: LockHandler) => Promise; /** * (get) A function that binds `try` method with current instance. */ readonly trier: (handler: LockHandler) => Promise; }