MCPcopy Create free account
hub / github.com/microsoft/SandDance / drainQueue

Function drainQueue

docs/tests/v2/es6/js/sanddance.js:237–263  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

235}
236
237function drainQueue() {
238 if (draining) {
239 return;
240 }
241
242 var timeout = runTimeout(cleanUpNextTick);
243 draining = true;
244 var len = queue.length;
245
246 while (len) {
247 currentQueue = queue;
248 queue = [];
249
250 while (++queueIndex < len) {
251 if (currentQueue) {
252 currentQueue[queueIndex].run();
253 }
254 }
255
256 queueIndex = -1;
257 len = queue.length;
258 }
259
260 currentQueue = null;
261 draining = false;
262 runClearTimeout(timeout);
263}
264
265process.nextTick = function (fun) {
266 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