site/node_modules/async-mutex/lib/MutexInterface.d.ts

18 lines
479 B
TypeScript
Raw Normal View History

2024-10-14 06:09:33 +00:00
interface MutexInterface {
acquire(priority?: number): Promise<MutexInterface.Releaser>;
runExclusive<T>(callback: MutexInterface.Worker<T>, priority?: number): Promise<T>;
waitForUnlock(priority?: number): Promise<void>;
isLocked(): boolean;
release(): void;
cancel(): void;
}
declare namespace MutexInterface {
interface Releaser {
(): void;
}
interface Worker<T> {
(): Promise<T> | T;
}
}
export default MutexInterface;