« get me outta code hell

Metadata (stored, throttle, status, and more) - mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
path: root/general-util.js
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2019-02-25 12:06:27 -0400
committerFlorrie <towerofnix@gmail.com>2019-02-25 12:06:27 -0400
commite9ccfa2fd4221ddff4950d5180ee5c8fb0bf8117 (patch)
tree917fb878b8ba0166bb324f3781a756d516a639ca /general-util.js
parent75251bb2309505c20dc7500117a17649d41412d8 (diff)
Metadata (stored, throttle, status, and more)
Diffstat (limited to 'general-util.js')
-rw-r--r--general-util.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/general-util.js b/general-util.js
index 708e150..a7bfb11 100644
--- a/general-util.js
+++ b/general-util.js
@@ -111,7 +111,7 @@ module.exports.throttlePromise = function(maximumAtOneTime = 10) {
     })
   }
 
-  return function(callback) {
+  const enqueue = function(callback) {
     if (activeCount >= maximumAtOneTime) {
       return new Promise((resolve, reject) => {
         queue.push(function() {
@@ -122,6 +122,10 @@ module.exports.throttlePromise = function(maximumAtOneTime = 10) {
       return execute(callback)
     }
   }
+
+  enqueue.queue = queue
+
+  return enqueue
 }
 
 module.exports.getTimeStringsFromSec = function(curSecTotal, lenSecTotal) {