Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    callback_trackerpublic

    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);
        }));
      });
    }
    

    Keywords

    none

    install

    npm i callback_tracker

    Downloadsweekly downloads

    16

    version

    0.1.0

    license

    mit

    repository

    githubgithub

    last publish

    collaborators

    • avatar