1.2.6 • Published 1 year ago

request-limit-pool v1.2.6

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

request-pool

useage

import RequestPool from 'request-limit-pool';

//set the maximum number of requests to 3. default is 3.
const requestPool = new RequestPool(3);

// the request method must return a promise instance
const request = () => {
  return fetchUser().then((data) => {
    // processing data
  });
};

// then push the request to the queue and request-pool will excute it
requestPool.push(request);
requestPool.push(request);
requestPool.push(request);
requestPool.push(request);

// when all requests are finished,the callback will be called
const unsubscribe = requestPool.done(() => {
  // is done
  //...
  unsubscribe();
});

// you can subscribe multiple times.
requestPool.done(() => {
  // is done
});
1.2.6

1 year ago

1.2.5

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago