
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
The join / synchronize module of FuturesJS (Browser, Node.js, Bower, and Pakmanager)
Joins any number of asynchronous calls together -
similar to how pthread_join works for C threads
and when() works for Q-style promises.
It's basically a callback counter that lets you know when everything is done.
Node.JS (Server):
npm install join
Browser:
You can install from bower:
bower install join
Or download the raw file from https://raw.github.com/FuturesJS/join/master/join.js:
wget https://raw.github.com/FuturesJS/join/master/join.js
<script src="join.js"></script>
;(function () {
'use strict';
var join = window.Join.create()
;
// Use `join.add()` in place of a callback function
setTimeout(join.add(), 500, 'I', 'really');
setTimeout(join.add(), 700, 'really', 'LOVE');
setTimeout(join.add(), 200, 'JavaScript');
// Use `join.notify()` for incremental updates
join.notify(function (i, args) {
console.log(
'Callback #' + (i + 1)
+ ' of ' + join.length
+ ' completed', args
);
});
// Use `join.then(cb)` to fire `cb` when all of the `join.add()` callbacks have been called.
join.then(function (i, love, js) {
console.log('All of the timeouts have completed');
console.log(i, love, js);
});
}());
'use strict';
var request = require('request')
, Join = require('join').Join
, join = Join.create()
;
// Use `join.add()` in place of a callback function
request.get('https://www.google.com', join.add());
request.get('http://www.yahoo.com', join.add());
request.get('https://www.bing.com', join.add());
// Use `join.notify()` for incremental updates
join.notify(function (i, args) {
console.log(
'Callback #' + (i + 1)
+ ' of ' + join.length
+ ' completed', args
);
});
// Use `join.then(cb)` to fire `cb` when all of the `join.add()` callbacks have been called.
join.then(function (googleArgs, yahooArgs, bingArgs) {
console.log('All of the requests have completed');
console.log(googleArgs[2]);
console.log(yahooArgs[2]);
console.log(bingArgs[2]);
});
Join
join = Join.create(defaultContext=null) - create a Join that will count callbacksjoin.add() - creates a joinable callback that you can throw aroundjoin.notify(progressCallback, context=null)join.then(finalCallback, context=null)
finalCallback when all joined callbacks have completedadd()join.length - the number of times join.add() has been calledThe arguments to join.then(cb) are in the order that the join.add() were called.
callbackA = join.add();
callbackB = join.add();
doAsyncStuff(callbackB);
doAsyncStuff(callbackA);
join.then(function (callbackAArgs, callbackBArgs) {
console.log(callbackAArgs, callbackBArgs);
});
If you handle the join callback inside of another callback then you'll need to place the join callback in the parent scope.
Fails:
request.get('http://www.yahoo.com', join.add());
setTimeout(function () {
request.get('https://www.bing.com', join.add());
}, 100);
join.then(function () {
console.log('all completed');
});
Works as expected:
request.get('http://www.yahoo.com', join.add());
bingCallback = join.add()
setTimeout(function () {
request.get('https://www.bing.com', bingCallback);
}, 100);
thisnessFails:
// `doStuff` loses the `this` binding to `myObject`
join.then(myObject.doStuff);
Works as expected:
// `doStuff` retains the `this` binding
join.then(myObject.doStuff, myObject);
Also works as expected:
// `doStuff` retains the `this` binding
join.then(function (argsA, argsB, argsC) {
myObject.doStuff(argsA, argsB, argsC);
});
FAQs
The join / synchronize module of FuturesJS (Browser, Node.js, Bower, and Pakmanager)
We found that join demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.