Skip to content
This repository has been archived by the owner on Nov 9, 2018. It is now read-only.

Determine promise library to use #6

Open
JasonBock opened this issue Sep 22, 2014 · 2 comments
Open

Determine promise library to use #6

JasonBock opened this issue Sep 22, 2014 · 2 comments

Comments

@JasonBock
Copy link
Contributor

A fair amount of DP operations need to be asynchronous. Using promises is what we should use - we need to figure out the best approach here (i.e. use a library to support this, create our own that's compliant, etc.)

@fauxtrot
Copy link

fauxtrot commented Dec 3, 2014

I'll be picking this one up, post Dec 11, 2014

@fauxtrot
Copy link

Findings

I will never advocate for the creation of a library that will be necessary to be maintained when there are some great options tried and true in the functionality space we need to cover. That being said, here are my findings:

After a bit of research on this, I recommend that we use a library. It seems to me that we should probably use a polyfill library that is actually a subset of RSVP.js (or just RSVP.js itself) This would keep us aligned with ES6-Promises/A+ while giving us the option to (using some sort of library management?) include the polyfill or actual library when working with cslajs.

see https://github.com/jakearchibald/es6-promise

Some options that didn't pan out:
* jQuery (uses deferreds, see the html5rocks article for a brief description)
* Q - Didn't dislike it. However, RSVP.js is what the author of Q (along with other) puts forth as a polyfill library.
* WinJS - I'm not against it. See the previous reason.

There are a number of others.

Please let me know if we need more factual evidence or comparison code for promises. Otherwise, I would propose that we move forward with RSVP.js as the promise library of choice.

##Aside:##
As far as usage of these libraries, it is a relatively simple process.

An example from the html5 rocks page is as follows (see the tutorial for more complex scenarios):

   get('story.json').then(function(response) {
      console.log("Success!", response);
   }, function(error) {
      console.log("Failed!", error);
   });

##Sources##

http://www.html5rocks.com/en/tutorials/es6/promises/
https://github.com/jakearchibald/es6-promise#readme

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

No branches or pull requests

2 participants