New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

setrace

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

setrace

It's a Barrier for your sets of async routines.

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

SetRace

It's a Barrier for your sets of async routines.

To run a callback when all conditions are met, it's this simple:

// Define the list of names for the conditions.
const conditions = [
  'downloaded_a',
  'downloaded_b',
  'timeout'
];

// Define what needs to run when all conditions are met.
const runAtTheEnd = () => {
  console.log('All conditions met!');
};

// Create the race.
const race = SETRACE(conditions, runAtTheEnd);

// Launch async tasks, one for each condition.
$.get(someUrlA, (data) => {
  // Do things with `data`.
  
  // Flag the condition as met.
  race.set['downloaded_a']();
});

$.get(someUrlB, (data) => {
  // Do things with `data`.
  
  // Flag the condition as met.
  race.set['downloaded_b']();
});

window.setTimeout(race.set['timeout'], 3000);

// Now when all three conditions are met, `runAtTheEnd` will be called.

FAQs

Package last updated on 29 Jun 2016

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