importRequestPoolfrom'request-limit-pool';//set the maximum number of requests to 3. default is 3.constrequestPool=newRequestPool(3);// the request method must return a promise instanceconstrequest=()=>{returnfetchUser().then((data)=>{// processing data});};// then push the request to the queue and request-pool will excute itrequestPool.push(request);requestPool.push(request);requestPool.push(request);requestPool.push(request);// when all requests are finished,the callback will be calledconstunsubscribe=requestPool.done(()=>{// is done//...unsubscribe();});// you can subscribe multiple times.requestPool.done(()=>{// is done});