js: while(apop)

This commit is contained in:
ed 2026-08-02 23:02:44 +00:00
parent 2880117265
commit 2c4033831f
2 changed files with 6 additions and 3 deletions

View file

@ -2512,6 +2512,7 @@ function up2k_init(subtle) {
keepalive = t.keepalive, keepalive = t.keepalive,
me = Date.now(); me = Date.now();
while (apop(st.todo.handshake, t));
if (t.done) if (t.done)
return console.log('done; skip hs', t.name, t); return console.log('done; skip hs', t.name, t);

View file

@ -1199,8 +1199,10 @@ function has(haystack, needle) {
function apop(arr, v) { function apop(arr, v) {
var ofs = arr.indexOf(v); var ofs = arr.indexOf(v);
if (ofs !== -1) if (ofs !== -1) {
arr.splice(ofs, 1); arr.splice(ofs, 1);
return true;
}
} }
@ -1466,7 +1468,7 @@ function Debounce(delay) {
}; };
r.rm = function (fun) { r.rm = function (fun) {
apop(r.q, fun); while (apop(r.q, fun));
}; };
r.run = function () { r.run = function () {
@ -1526,7 +1528,7 @@ var timer = (function () {
}; };
r.rm = function (fun) { r.rm = function (fun) {
apop(r.q, fun); while (apop(r.q, fun));
}; };
var doevents = function () { var doevents = function () {