()
| 901 | } |
| 902 | |
| 903 | function drainQueue() { |
| 904 | if (draining) { |
| 905 | return; |
| 906 | } |
| 907 | var timeout = runTimeout(cleanUpNextTick); |
| 908 | draining = true; |
| 909 | |
| 910 | var len = queue.length; |
| 911 | while(len) { |
| 912 | currentQueue = queue; |
| 913 | queue = []; |
| 914 | while (++queueIndex < len) { |
| 915 | if (currentQueue) { |
| 916 | currentQueue[queueIndex].run(); |
| 917 | } |
| 918 | } |
| 919 | queueIndex = -1; |
| 920 | len = queue.length; |
| 921 | } |
| 922 | currentQueue = null; |
| 923 | draining = false; |
| 924 | runClearTimeout(timeout); |
| 925 | } |
| 926 | |
| 927 | process.nextTick = function (fun) { |
| 928 | var args = new Array(arguments.length - 1); |
no test coverage detected