UNPKG

async-mutex

Version:
18 lines (17 loc) 426 B
interface MutexInterface { acquire(): Promise<MutexInterface.Releaser>; runExclusive<T>(callback: MutexInterface.Worker<T>): Promise<T>; waitForUnlock(): Promise<void>; isLocked(): boolean; release(): void; cancel(): void; } declare namespace MutexInterface { interface Releaser { (): void; } interface Worker<T> { (): Promise<T> | T; } } export default MutexInterface;