Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deferreds #8

Open
slawrence opened this issue Jan 10, 2014 · 0 comments
Open

deferreds #8

slawrence opened this issue Jan 10, 2014 · 0 comments

Comments

@slawrence
Copy link

A suggestion for circuits-js:

Instead of in all cases defining an object with 'onLoad' and 'onError' properties to handle callbacks, could we modify circuits to return a promise so we can utilize some of dojo's nifty promise apis?

For example:

var deferred = this.idsService.queryIDSList({
       caseNumber: caseObj.caseNumber,
       count: 500,
      fields: "caseFillingDate,date,documents,idsId,signedDate,sourceAbbreviation,sourceTitle"
 });

deferred.then(function (res) {
...
}, function (error) {
...
});

It'd be really nice to use 'dojo/promise/all' and 'dojo/when' in a lot of cases.

all([metadataReq, docInfoReq, graphReq]).then(function(results){
    //start rendering - results will contain each result
  });

Finally, we could mix and match circuits stuff with regular dojo/requests calls (since they return deferreds). http://dojotoolkit.org/documentation/tutorials/1.8/deferreds/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant