From 7363662c38ef6690030bc18ed99251d30ad1e893 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Tue, 22 Dec 2020 06:09:47 +0300 Subject: [PATCH] another fix -- JS argument length limitation... Signed-off-by: Alex A. Naanou --- package.json | 2 +- runner.js | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 5356dea..8a544ec 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ig-types", - "version": "6.0.6", + "version": "6.0.7", "description": "Generic JavaScript types and type extensions...", "main": "main.js", "scripts": { diff --git a/runner.js b/runner.js index ac0cd8a..4d31b77 100644 --- a/runner.js +++ b/runner.js @@ -485,6 +485,7 @@ object.Constructor('Queue', Array, { // // NOTE: adding tasks via the [..] notation will not trigger the // event... + // // XXX add methods that can shorten the queue (like .pop()/.shift()/..) // to test and trigger .queueEmpty() // ...this is not and will not be done on polling as that would @@ -508,7 +509,15 @@ object.Constructor('Queue', Array, { return res }, // shorthands... - add: function(...tasks){ + // + // NOTE: this helps get around the argument number limitation in JS... + add: function(tasks){ + // handle too large a number of args... + var MAX_ARGS = 10000 + if(tasks.length > MAX_ARGS){ + while(tasks.length > 0){ + this.push(...tasks.splice(0, MAX_ARGS)) } + return this } this.push(...tasks) return this }, // NOTE: this will also clear the results cache...