aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHolden Rohrer <holden.rohrer@gmail.com>2020-01-08 21:07:11 -0500
committerHolden Rohrer <holden.rohrer@gmail.com>2020-01-08 21:07:11 -0500
commit492af8740f40cb3370dcd11b4f5f27306f21c7fd (patch)
tree0027334a3bd1d56da22e83f70b571db2686b6bce
parent77743bffc691d3b304f9176c5ae9c15996e6ca56 (diff)
queue.enqueue passed as array
-rw-r--r--examples/jarvis.js6
-rw-r--r--tools/queue.js6
2 files changed, 6 insertions, 6 deletions
diff --git a/examples/jarvis.js b/examples/jarvis.js
index 2516687..76e8aa1 100644
--- a/examples/jarvis.js
+++ b/examples/jarvis.js
@@ -107,7 +107,7 @@ function notifRefresh(){
}
function timect(){
- writes.enqueue(...notifRefresh());
+ writes.enqueue(notifRefresh());
minsUp++;
setTimeout(timect, 60*1000);
}
@@ -124,7 +124,7 @@ function protectArea(send, tiles, locs){
inter.comb(tile, comb.unmask);
let diff = notif.copy(); // Actually diffs notify with the errant text
diff.comb(inter, comb.sub);
- writes.enqueue(...diff.towrite())
+ writes.enqueue(diff.towrite())
// Mask the tile
let newtile = notif.copy();
newtile.comb(tile, comb.mask);
@@ -159,6 +159,6 @@ function respond(coord){
console.log('called at', coord);
callct += 1;
response.loc = coord;
- writes.enqueue(...response.towrite().concat(notifRefresh()));
+ writes.enqueue(response.towrite().concat(notifRefresh()));
read.update(response);
}
diff --git a/tools/queue.js b/tools/queue.js
index cbd515b..1e2b073 100644
--- a/tools/queue.js
+++ b/tools/queue.js
@@ -6,9 +6,9 @@ module.exports = function(delayms, maxExport, call){
let getObjs = (maxExport == 1) ?
() => queue.shift() :
() => queue.splice(0, maxExport) ;
- this.enqueue = function(){
- for (let i = 0; i < arguments.length; i++)
- queue.push(arguments[i]);
+ this.enqueue = function(arr){
+ for (item of arr)
+ queue.push(item);
if (open) dequeue();
}