diTii.com Digital News Hub

Sign up with your email address to be the first to know about latest news and more.

I agree to have my personal information transfered to MailChimp (more information)


Dojo Deferred and DFS

Brian McCallister has written about Dojo Deferred and DFS —”A while back I talked about the “DataFlowSequence” which Tim and I came up with for dealing with concurrent XHRs. In the interim Dojo created a Deferred class based on MochiKit‘s Deferred class, which in turn is based on Twisted‘s Deferred. Using Dojo’s goes like this:

var d = new dojo.Deferred();

// register callback

d.addCallback(function(name) {
log.debug("name: " + name)

// supply data
d.callback("Sam Jones");

Deferred has an additional registerable callback, an errback, which is called if Deferred#errback(value) is invoked instead of Deferred#callback(value).

var d = new dojo.Deferred();
d.addCallback(function(v) { log.debug("success! : " + v) })
d.addErrback(function(e) { log.debug("error! : " + v) })

if (Math.random() > 0.5) {
else {

For more info…


Dojo Deferred and DFS, Dojo

Share This Story, Choose Your Platform!