aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/queue.js6
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);