Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Dojo deferreds as a nodejs module - Work in Progress
JavaScript
Branch: master
Failed to load latest commit information.
lib Unit tests for DeferredGroup
test Unit tests for DeferredGroup
README.md More README

README.md

Dojo deferreds as a nodejs module

This is a port of dojo.Deferred to node.js. I am also working on DeferredGroup, an elegant wrapper to execute several Deferreds an parallel and aggregate the results.

Note

So far this Deferred port has been altered in 1 major way. By default, dojo Deferreds execute every callback function in a try..catch block. This implementation does not. I think it is a bad idea to have this the default behavior as it will cause people countless hours of debugging since there will be no automatic feedback on their exceptions.

If you want to use the try..catch mechanism for callbacks, you have to specify it like this:

var d = new Deferred();
d
  .trycatch()
  .addCallback(function() {
    throw new Error("catchme");
  })
  .addErrback(function(e) {
    // e.message == "catchme"
  });

d.callback();

The addErrback is not needed for this example to work, but it shows you how to handle the exception trigger in the initial callback.

Todo

  • Unit tests
  • Re-factor code to my liking
  • Docs for DeferredGroup
Something went wrong with that request. Please try again.