Dojo deferreds as a nodejs module - Work in Progress
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

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.


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();
  .addCallback(function() {
    throw new Error("catchme");
  .addErrback(function(e) {
    // e.message == "catchme"


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


  • Unit tests
  • Re-factor code to my liking
  • Docs for DeferredGroup