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: […]

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 callbackd.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) { d.callback("yea!") } else { d.errback("boo!") }

For more info...

ajaxian

Dojo Deferred and DFS, Dojo