Debian Codegraph @

util/build/fileHandleThrottle.js

raw symbols SCIP
1 define([], function(){
2 var
3 count = 0,
4 max = 10,
5 queue = [];
6 return {
7 release:function(){
8 if(queue.length){
9 (queue.shift())();
10 }else{
11 count--;
12 }
13 },
14 enqueue:function(proc){
15 if(count<max){
16 count++;
17 proc();
18 }else{
19 queue.push(proc);
20 }
21 }
22 };
23 });