New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

asynchronizer

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asynchronizer

Promise for collecting data through multiple asynchronous events in JavaScript.

  • 0.1.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Asynchronizer Build Status

A promise that waits for a list of given of conditions to occur. Optionally collects data from the conditions.

This can be used to collect data from a variety of asynchronous data sources, and process them all at once when done.

// Create a new Asynchronizer, which waits for two specified events.
asynchronizer = new Asynchronizer(['event one', 'event two']);

// Tell the Asynchronizer what to do when all of the events have happened.
asynchronizer.then(function(data) {
  // This method will be fired once the events with name
  // 'event one' and 'event two' have occurred.
  console.log("All done! The collected data is: " + data.join(', '));
});

// Do some things here....

// At some point in your code, event one has happened.
// Tell the Asynchronizer about it.
asynchronizer.check('event one', 'data for event one');

// At this point the Asynchronizer still waits for event two,
// so the callback does not get triggered.

// Do more things here....

// At some other point event two has happened.
// Lets give Asynchronizer the good news.
asynchronizer.check('event two', 'data for event two');

// This is the last event that our Asynchronizer instance was waiting for.
// So this will cause the Asynchronizer to call the callback given to it
// in the "then" method, with the collected data.
// In this example, the console would say:
// "All done! The collected data is: data for event one, data for event two"

Development

  • set up development environment: npm install
  • run the tests: npm test or script/watch_tests for continuous testing
  • release a new patch version: tools/release
  • compile the binary: gulp (this is done automatically for you in the release script)

FAQs

Package last updated on 26 Feb 2014

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