diff options
author | Holden Rohrer <holden.rohrer@gmail.com> | 2020-01-09 14:10:59 -0500 |
---|---|---|
committer | Holden Rohrer <holden.rohrer@gmail.com> | 2020-01-09 14:10:59 -0500 |
commit | e3b0e5f511e09e06a4d10cce7c28cbe669755cb6 (patch) | |
tree | ad2412ab82be218d22f0bd43ef88813678abf4bf /tools | |
parent | 93a85ad37cefc4a704005d3e08f8afcd77bd43c0 (diff) |
simplified queue.js
Diffstat (limited to 'tools')
-rw-r--r-- | tools/queue.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/queue.js b/tools/queue.js index 1e2b073..d8853e4 100644 --- a/tools/queue.js +++ b/tools/queue.js @@ -1,11 +1,13 @@ // A generalized queue object for rapid responses (doesn't do prioritization or algorithmic timesharing) +// .enable must be used to start it, and .enqueue can be used at any time module.exports = function(delayms, maxExport, call){ let queue = []; let open = true; // The meaning of this variable is complicated, so watch closely - let getObjs = (maxExport == 1) ? + let getObjs = (maxExport == 1) ? // Should call be given one object or an array? () => queue.shift() : - () => queue.splice(0, maxExport) ; + () => queue.splice(0, maxExport); + this.enqueue = function(arr){ for (item of arr) queue.push(item); |