UNPKG

@uploadx/core

Version:
19 lines (18 loc) 441 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Locker = void 0; const index_1 = require("./index"); class Locker extends index_1.Cache { lock(key) { const locked = this.get(key); if (locked) { throw new Error(`${key} is locked`); } this.set(key, key); return key; } unlock(key) { this.delete(key); } } exports.Locker = Locker;