npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

simple-join

v0.1.1

Published

Stupidly Simple Asynchronous Joins for Javascript

Downloads

33

Readme

simple-join

Stuidly simple library to help join asynchronous callbacks in Javascript

Install

$ npm install simple-join

Usage

Simple joining
	var join = require('simple-join');

	var wait = new join(2,function(){

		console.log("DONE");
	});

	setTimeout(function(){ wait.done(); }, 3000);

	setTimeout(function(){ wait.done(); }, 5000);
Simple joining, with error & success information
	var join = require('simple-join');

	var wait = new join(2,function(status){

		console.log(status); //{"total":2,"errors":1,"success":1,"messages":["my error message"]}
	});

	setTimeout(function(){ wait.success(); }, 3000);

	setTimeout(function(){ wait.error('my error message'); }, 5000);

Methods

join(num,callback)

Parameters:

  • num (number) - number of joins to be comlpeted before running callback
  • callback (function) - callback function to be run when all joins are completed. Passed the status object (see join.status method)

Returns:

  • (object) new instance of the object

Example:

	var wait = new join(3,function(status){
		//Run when we've joined all 3 
	});

join.done(num)

Signals that a join(s) is completed

Parameters:

  • num (number, optional) - number of joins to be crossed off the list, default is 1

Returns:

  • (number) number of joins that we're still waiting for

Example:

	wait.done();
	wait.done(2);

join.success(num)

Signals that a join(s) is completed, and was 'successful'

Parameters:

  • num (number, optional) - number of joins to be crossed off the list, default is 1

Returns:

  • (number) number of joins that we're still waiting for

Example:

	wait.success();
	wait.success(2);

join.error(val)

Signals that a join(s) is completed, but with an 'error'.

Parameters:

  • val (number, optional) - number of joins to be crossed off the list, default is 1

OR

  • val (string, optional) - error message to be recorded

Returns:

  • (number) number of joins that we're still waiting for

Example:

	wait.error();
	wait.error(2);
	wait.error('My error message');

join.status()

Get the join status object (same as object passed to the callback)

Parameters: None

Returns (object):

  • total (number) : total number of joins when join was created
  • success (number) : number of joins completed that were successful (via join.success)
  • errors (number) : number of joins that had errors (via join.error)
  • messages (array) : array of errors messages (via join.error)

Example:

	wait.status();
	{
		"total":2,
		"success":1,
		"errors":1,
		"messages":["My error message"]
	}