10 lines
472 B
JavaScript
10 lines
472 B
JavaScript
|
|
"use strict";
|
||
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||
|
|
exports.getSynchronize = void 0;
|
||
|
|
const getMutex_1 = require("./getMutex");
|
||
|
|
const getSynchronize = (mutex) => {
|
||
|
|
const lock = mutex !== null && mutex !== void 0 ? mutex : (0, getMutex_1.getMutex)();
|
||
|
|
return (action, lockId) => lock(lockId).then(unlock => Promise.resolve().then(action).finally(unlock));
|
||
|
|
};
|
||
|
|
exports.getSynchronize = getSynchronize;
|
||
|
|
//# sourceMappingURL=getSynchronize.js.map
|