Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

batchcalls

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

batchcalls

Batches calls to a function and passes arguments as arrays

  • 0.4.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

batchcalls

Batches calls to a function and passes arguments as arrays

var batchCalls = require('batchcalls');
var request = batchCalls(function (ids) {
  fetch('/users/?ids=' + ids.join(',')).then(doSomething);
});
var ids = ['1', '2', '3'];

ids.forEach(request);
var batchCalls = require('batchcalls');
var clicksWithinSecond = batchCalls(function (events) {
  // Do something
}, {
  wait: 1000
});

document.body.addEventListener('click', clicksWithinSecond);
var batchCalls = require('batchcalls');
var executeAfter5Clicks = batchCalls(function (events) {
  // Do something
}, {
  count: 5
});

document.body.addEventListener('click', executeAfter5Clicks);
var batchCalls = require('batchcalls');
var executeOnConditional = batchCalls(function (batchedArgs) {
  // Will batch as long as conditional is true
}, {
  conditional: function (args, prevArgs) {
    return args[0].foo === prevArgs[0].foo;
  }
});

Keywords

FAQs

Package last updated on 18 Jun 2015

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc