UNPKG

async-mutex

Version:
13 lines (12 loc) 401 B
import MutexInterface from './MutexInterface'; declare class Mutex implements MutexInterface { constructor(cancelError?: Error); acquire(): Promise<MutexInterface.Releaser>; runExclusive<T>(callback: MutexInterface.Worker<T>): Promise<T>; isLocked(): boolean; waitForUnlock(): Promise<void>; release(): void; cancel(): void; private _semaphore; } export default Mutex;