MCPcopy
hub / github.com/microsoft/SandDance / drainQueue

Function drainQueue

docs/app/js/sanddance-app.js:52772–52787  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

52770 if (queue.length) drainQueue();
52771}
52772function drainQueue() {
52773 if (draining) return;
52774 var timeout = runTimeout(cleanUpNextTick);
52775 draining = true;
52776 var len = queue.length;
52777 while(len){
52778 currentQueue = queue;
52779 queue = [];
52780 while(++queueIndex < len)if (currentQueue) currentQueue[queueIndex].run();
52781 queueIndex = -1;
52782 len = queue.length;
52783 }
52784 currentQueue = null;
52785 draining = false;
52786 runClearTimeout(timeout);
52787}
52788process.nextTick = function(fun) {
52789 var args = new Array(arguments.length - 1);
52790 if (arguments.length > 1) for(var i = 1; i < arguments.length; i++)args[i - 1] = arguments[i];

Callers 1

cleanUpNextTickFunction · 0.70

Calls 3

runTimeoutFunction · 0.70
runClearTimeoutFunction · 0.70
runMethod · 0.45

Tested by

no test coverage detected