Skip to content
This repository was archived by the owner on Jan 14, 2022. It is now read-only.

Commit ce3c65a

Browse files
committed
make it work off an instance
1 parent 4303076 commit ce3c65a

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

lib/promiseQueue.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
export class PromiseQueue {
2-
static queue = [];
3-
static pending = false;
4-
static stop = false;
2+
queue = [];
3+
pending = false;
4+
stop = false;
55

6-
static enqueue(promise) {
6+
constructor() {
7+
this.queue = [];
8+
this.pending = false;
9+
this.stop = false;
10+
}
11+
12+
enqueue(deferred) {
713
return new Promise((resolve, reject) => {
814
this.queue.push({
915
promise,
@@ -14,7 +20,7 @@ export class PromiseQueue {
1420
});
1521
}
1622

17-
static dequeue() {
23+
dequeue() {
1824
if (this.workingOnPromise) {
1925
return false;
2026
}

0 commit comments

Comments
 (0)