MCPcopy Index your code
hub / github.com/BrainJS/brain.js / drainQueue

Function drainQueue

browser.js:23362–23384  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23360}
23361
23362function drainQueue() {
23363 if (draining) {
23364 return;
23365 }
23366 var timeout = runTimeout(cleanUpNextTick);
23367 draining = true;
23368
23369 var len = queue.length;
23370 while(len) {
23371 currentQueue = queue;
23372 queue = [];
23373 while (++queueIndex < len) {
23374 if (currentQueue) {
23375 currentQueue[queueIndex].run();
23376 }
23377 }
23378 queueIndex = -1;
23379 len = queue.length;
23380 }
23381 currentQueue = null;
23382 draining = false;
23383 runClearTimeout(timeout);
23384}
23385
23386process.nextTick = function (fun) {
23387 var args = new Array(arguments.length - 1);

Callers 1

cleanUpNextTickFunction · 0.70

Calls 3

runTimeoutFunction · 0.70
runClearTimeoutFunction · 0.70
runMethod · 0.45

Tested by

no test coverage detected