Socket
Socket
Sign inDemoInstall

queue-request

Package Overview
Dependencies
0
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    queue-request

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


Version published
Weekly downloads
87
decreased by-23.68%
Maintainers
1
Install size
6.67 kB
Created
Weekly downloads
 

Readme

Source

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 ©

FAQs

Last updated on 15 Dec 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc