mirror of
https://github.com/cryptpad/cryptpad.git
synced 2026-09-14 11:05:41 +05:00
Fix teams deletion issue after refactoring
This commit is contained in:
parent
f8fb7238d2
commit
c40973e2a0
@ -813,36 +813,38 @@
|
||||
* https://www.npmjs.com/package/saferphore (MIT license)
|
||||
* because the umd definition doesn't work with rollup build
|
||||
*/
|
||||
Util.saferphore = resourceCount => {
|
||||
var queue = [];
|
||||
var check;
|
||||
var mkRa = function () {
|
||||
var outerCalled = 0;
|
||||
return function (func) {
|
||||
if (outerCalled++) { throw new Error("returnAfter() called multiple times"); }
|
||||
var called = 0;
|
||||
return function () {
|
||||
if (called++) {
|
||||
throw new Error("returnAfter wrapped callback called multiple times");
|
||||
}
|
||||
if (func) { func.apply(null, arguments); }
|
||||
resourceCount++;
|
||||
check();
|
||||
Util.Saferphore = {
|
||||
create: resourceCount => {
|
||||
var queue = [];
|
||||
var check;
|
||||
var mkRa = function () {
|
||||
var outerCalled = 0;
|
||||
return function (func) {
|
||||
if (outerCalled++) { throw new Error("returnAfter() called multiple times"); }
|
||||
var called = 0;
|
||||
return function () {
|
||||
if (called++) {
|
||||
throw new Error("returnAfter wrapped callback called multiple times");
|
||||
}
|
||||
if (func) { func.apply(null, arguments); }
|
||||
resourceCount++;
|
||||
check();
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
check = function () {
|
||||
if (resourceCount < 0) { throw new Error("(resourceCount < 0) should never happen"); }
|
||||
if (resourceCount === 0 || queue.length === 0) { return; }
|
||||
resourceCount--;
|
||||
queue.shift()(mkRa());
|
||||
};
|
||||
return {
|
||||
take: function (func) {
|
||||
queue.push(func);
|
||||
check();
|
||||
}
|
||||
};
|
||||
check = function () {
|
||||
if (resourceCount < 0) { throw new Error("(resourceCount < 0) should never happen"); }
|
||||
if (resourceCount === 0 || queue.length === 0) { return; }
|
||||
resourceCount--;
|
||||
queue.shift()(mkRa());
|
||||
};
|
||||
return {
|
||||
take: function (func) {
|
||||
queue.push(func);
|
||||
check();
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
/* End of code copied from saferphore */
|
||||
|
||||
|
||||
@ -813,36 +813,38 @@
|
||||
* https://www.npmjs.com/package/saferphore (MIT license)
|
||||
* because the umd definition doesn't work with rollup build
|
||||
*/
|
||||
Util.saferphore = resourceCount => {
|
||||
var queue = [];
|
||||
var check;
|
||||
var mkRa = function () {
|
||||
var outerCalled = 0;
|
||||
return function (func) {
|
||||
if (outerCalled++) { throw new Error("returnAfter() called multiple times"); }
|
||||
var called = 0;
|
||||
return function () {
|
||||
if (called++) {
|
||||
throw new Error("returnAfter wrapped callback called multiple times");
|
||||
}
|
||||
if (func) { func.apply(null, arguments); }
|
||||
resourceCount++;
|
||||
check();
|
||||
Util.Saferphore = {
|
||||
create: resourceCount => {
|
||||
var queue = [];
|
||||
var check;
|
||||
var mkRa = function () {
|
||||
var outerCalled = 0;
|
||||
return function (func) {
|
||||
if (outerCalled++) { throw new Error("returnAfter() called multiple times"); }
|
||||
var called = 0;
|
||||
return function () {
|
||||
if (called++) {
|
||||
throw new Error("returnAfter wrapped callback called multiple times");
|
||||
}
|
||||
if (func) { func.apply(null, arguments); }
|
||||
resourceCount++;
|
||||
check();
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
check = function () {
|
||||
if (resourceCount < 0) { throw new Error("(resourceCount < 0) should never happen"); }
|
||||
if (resourceCount === 0 || queue.length === 0) { return; }
|
||||
resourceCount--;
|
||||
queue.shift()(mkRa());
|
||||
};
|
||||
return {
|
||||
take: function (func) {
|
||||
queue.push(func);
|
||||
check();
|
||||
}
|
||||
};
|
||||
check = function () {
|
||||
if (resourceCount < 0) { throw new Error("(resourceCount < 0) should never happen"); }
|
||||
if (resourceCount === 0 || queue.length === 0) { return; }
|
||||
resourceCount--;
|
||||
queue.shift()(mkRa());
|
||||
};
|
||||
return {
|
||||
take: function (func) {
|
||||
queue.push(func);
|
||||
check();
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
/* End of code copied from saferphore */
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user