UNPKG

744 BTypeScriptView Raw
1/**
2 * An async mutex lock.
3 *
4 * @export
5 * @class Mutex
6 */
7export default class Mutex {
8 /**
9 * Lock for a specific key. If the lock has been acquired by another customer, then
10 * will wait until getting the lock.
11 *
12 * @static
13 * @param {string} key lock key
14 * @returns {Promise<void>}
15 * @memberof Mutex
16 */
17 static lock(key: string): Promise<void>;
18 /**
19 * Unlock a key.
20 *
21 * @static
22 * @param {string} key
23 * @returns {Promise<void>}
24 * @memberof Mutex
25 */
26 static unlock(key: string): Promise<void>;
27 private static keys;
28 private static listeners;
29 private static onUnlockEvent;
30 private static emitUnlockEvent;
31}
32//# sourceMappingURL=Mutex.d.ts.map
\No newline at end of file