2
0
mirror of https://github.com/esiur/esiur-js.git synced 2026-04-03 21:48:21 +00:00
This commit is contained in:
2020-04-30 09:26:58 +03:00
parent 98877b9b85
commit 5967d6c901
19 changed files with 2102 additions and 1784 deletions

View File

@@ -40,12 +40,20 @@ export default class AsyncQueue extends AsyncReply
this.processQueue = function ()
{
for (var i = 0; i < self.list.length; i++)
if (self.list[i].ready)
{
if (self.list[i].ready) {
self.trigger(self.list[i].result);
self.list.splice(i, 1);
self.ready = false;
//self.list.splice(i, 1);
self.list.shift();
i--;
}
else if (self.list[i].failed) {
self.ready = false;
self.list.shift();
i--;
console.log("AsyncQueue (Reply Failed)");
}
else
break;
@@ -57,11 +65,13 @@ export default class AsyncQueue extends AsyncReply
{
this.list.push(reply);
this.ready = false;
reply.then(this.processQueue);
reply.then(this.processQueue).error(this.processQueue);
}
remove(reply)
{
console.log("REMOVE QUEUE");
this.list.splice(this.list.indexOf(reply), 1);
this.processQueue();
}

View File

@@ -72,6 +72,7 @@ export default class IEventHandler
return this;
}
off(event, fn)
{
event = event.toLocaleString();