1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | type AsyncLockDoneCallback<T> = (err?: Error, ret?: T) => void;
|
10 |
|
11 | interface AsyncLockOptions {
|
12 | timeout?: number | undefined;
|
13 | maxPending?: number | undefined;
|
14 | maxOccupationTime?: number | undefined;
|
15 | domainReentrant?: boolean | undefined;
|
16 | Promise?: any;
|
17 | skipQueue?: boolean | undefined;
|
18 | }
|
19 |
|
20 | declare class AsyncLock {
|
21 | constructor(options?: AsyncLockOptions);
|
22 |
|
23 | acquire<T>(key: string | string[],
|
24 | fn: (() => T | PromiseLike<T>) | ((done: AsyncLockDoneCallback<T>) => any),
|
25 | opts?: AsyncLockOptions): Promise<T>;
|
26 | acquire<T>(key: string | string[],
|
27 | fn: (done: AsyncLockDoneCallback<T>) => any,
|
28 | cb: AsyncLockDoneCallback<T>,
|
29 | opts?: AsyncLockOptions): void;
|
30 |
|
31 | isBusy(key?: string): boolean;
|
32 | }
|
33 |
|
34 | declare namespace AsyncLock { }
|
35 |
|
36 | export = AsyncLock;
|