mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Note that this *trivially* updates project urls by adding the NPM url to the end, even when the urls are almost identical or the DT one is outdated. I'll clean up the urls in a later commit. This PR is unfinished! Please do not merge it yet.
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
// Type definitions for async-lock 1.1
|
|
// Project: https://github.com/rain1017/async-lock, https://github.com/rogierschouten/async-lock
|
|
// Definitions by: Elisée MAURER <https://github.com/elisee>
|
|
// Alejandro <https://github.com/afharo>
|
|
// Anatoly <https://github.com/rhymmor>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
// TypeScript Version: 2.1
|
|
|
|
type AsyncLockDoneCallback<T> = (err?: Error, ret?: T) => void;
|
|
|
|
interface AsyncLockOptions {
|
|
timeout?: number;
|
|
maxPending?: number;
|
|
domainReentrant?: boolean;
|
|
Promise?: any;
|
|
}
|
|
|
|
declare class AsyncLock {
|
|
constructor(options?: AsyncLockOptions);
|
|
|
|
acquire<T>(key: string | string[],
|
|
fn: (() => T | PromiseLike<T>) | ((done: AsyncLockDoneCallback<T>) => any),
|
|
opts?: AsyncLockOptions): Promise<T>;
|
|
acquire<T>(key: string | string[],
|
|
fn: (done: AsyncLockDoneCallback<T>) => any,
|
|
cb: AsyncLockDoneCallback<T>,
|
|
opts?: AsyncLockOptions): void;
|
|
|
|
isBusy(key?: string): boolean;
|
|
}
|
|
|
|
declare namespace AsyncLock { }
|
|
|
|
export = AsyncLock;
|