callback_tracker

0.1.0 • Public • Published

Callback Tracker

Sometimes you need to perform multiple operations before resolving an initial callback. This tool is a small and simple way to track all the callbacks.

example:

var tracker = require('callback_tracker');

function getOneThing(thingWanted, done) {
  //...

  // done(result);
}

function getAlotOfThings(thingsWanted, done) {
  var results = [];
  var track = tracker.create('done', function() {
    done(results);
  };

  thingsWanted.foreach(function(thingWanted) {
    getOneThing(thingWanted, track('getting ' + thingWanted, function(result) {
      results.push(result);
    }));
  });
}

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.0
    21
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.0
    21
  • 0.0.2
    2
  • 0.0.1
    1

Package Sidebar

Install

npm i callback_tracker

Weekly Downloads

24

Version

0.1.0

License

mit

Last publish

Collaborators

  • samshull