queue-request
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

queue-request

queue-request - library to collect duplicated async task in 1 queve, make 1 operation and return same Promise to every request

Problem and solution

Problem

Problem schema

Possible solution

Solution schema

Install

$ yarn add queue-request

Usage

const queueRequest = require('queue-request');


//One place in code
queueRequest({request: APIRequest, params: 1, processDelay: 90});
//Another place in code
queueRequest({request: APIRequest, params: 2, processDelay: 90});
//Another place in code
queueRequest({request: APIRequest, params: 3, processDelay: 90});
//Another place in code
queueRequest({request: APIRequest, params: 4, processDelay: 90});

/**
 * If code was called in margin of processDelay
 * in callstack it will call API only once
 * And resolve to same code
 */

Publish

$ git checkout master
$ yarn version
$ yarn publish
$ git push origin master --tags

License

MIT ©

Readme

Keywords

none

Package Sidebar

Install

npm i queue-request

Weekly Downloads

84

Version

0.0.2

License

MIT

Unpacked Size

6.83 kB

Total Files

10

Last publish

Collaborators

  • hmelenok