From e3b0e5f511e09e06a4d10cce7c28cbe669755cb6 Mon Sep 17 00:00:00 2001 From: Holden Rohrer Date: Thu, 9 Jan 2020 14:10:59 -0500 Subject: simplified queue.js --- tools/queue.js | 6 ++++-- 1 file 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); -- cgit