Spaces:
Sleeping
Sleeping
Download node_modules/@node-ipc/js-queue/queue.js from k-l-lambda/lotus: direct link, hf CLI and curl.
- Browser
- Download file 1.55 kB
-
https://huggingface.co/spaces/k-l-lambda/lotus/resolve/main/node_modules/%40node-ipc/js-queue/queue.js
- Command line
-
hf download hf://spaces/k-l-lambda/lotus/node_modules/@node-ipc/js-queue/queue.js
-
curl -L -o queue.js https://huggingface.co/spaces/k-l-lambda/lotus/resolve/main/node_modules/%40node-ipc/js-queue/queue.js
1.55 kB
| function Queue(asStack){ | |
| Object.defineProperties( | |
| this, | |
| { | |
| add:{ | |
| enumerable:true, | |
| writable:false, | |
| value:addToQueue | |
| }, | |
| next:{ | |
| enumerable:true, | |
| writable:false, | |
| value:run | |
| }, | |
| clear:{ | |
| enumerable:true, | |
| writable:false, | |
| value:clearQueue | |
| }, | |
| contents:{ | |
| enumerable:false, | |
| get:getQueue, | |
| set:setQueue | |
| }, | |
| autoRun:{ | |
| enumerable:true, | |
| writable:true, | |
| value:true | |
| }, | |
| stop:{ | |
| enumerable:true, | |
| writable:true, | |
| value:false | |
| } | |
| } | |
| ); | |
| var queue=[]; | |
| var running=false; | |
| var stop=false; | |
| function clearQueue(){ | |
| queue=[]; | |
| return queue; | |
| } | |
| function getQueue(){ | |
| return queue; | |
| } | |
| function setQueue(val){ | |
| queue=val; | |
| return queue; | |
| } | |
| function addToQueue(){ | |
| for(var i in arguments){ | |
| queue.push(arguments[i]); | |
| } | |
| if(!running && !this.stop && this.autoRun){ | |
| this.next(); | |
| } | |
| } | |
| function run(){ | |
| running=true; | |
| if(queue.length<1 || this.stop){ | |
| running=false; | |
| return; | |
| } | |
| queue.shift().bind(this)(); | |
| } | |
| } | |
| module.exports=Queue; | |