mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 04:49:15 +08:00
30 lines
830 B
TypeScript
30 lines
830 B
TypeScript
// Type definitions for async-lock
|
|
// Project: https://github.com/rain1017/async-lock
|
|
// Definitions by: Elisée MAURER <https://github.com/elisee>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
|
|
|
|
interface AsyncLockDoneCallback {
|
|
(err?: Error, ret?: any): void;
|
|
}
|
|
|
|
interface AsyncLockOptions {
|
|
timeout?: number;
|
|
maxPending?: number;
|
|
domainReentrant?: boolean;
|
|
Promise?: any;
|
|
}
|
|
|
|
declare class AsyncLock {
|
|
constructor(options?: AsyncLockOptions);
|
|
|
|
acquire(key: string | string[], fn: (done: AsyncLockDoneCallback) => any, cb: AsyncLockDoneCallback, opts?: AsyncLockOptions): void;
|
|
acquire(key: string | string[], fn: (done: AsyncLockDoneCallback) => any, opts?: AsyncLockOptions): PromiseLike<any>;
|
|
|
|
isBusy(): boolean;
|
|
}
|
|
|
|
declare namespace AsyncLock { }
|
|
|
|
export = AsyncLock;
|