-
Notifications
You must be signed in to change notification settings - Fork 6
Real? Bower? #6
Comments
I'm not sure of any other implementations, though I remember seeing some when we were determining what to use for Angular 2. This library actually just uses the ES6 Promise from the browser or Traceur, and adds a small deferred wrapper around it (which we're not sure we want to keep), and adds the ability to mock and synchronously flush the promise. I'm not sure how much we'll use this in Angular 2, it depends on how painful it is to test against native promise. |
It's just what I want. I think Deferred makes promises much easier to manage in libraries. I'd love to learn how I'm wrong. Are there any good examples of managing ES6 promises directly as properties? Sent from my Windows Phone From: Jeff Crossmailto:notifications@github.com I'm not sure of any other implementations, though I remember seeing some when we were determining what to use for Angular 2. This library actually just uses the ES6 Promise from the browser or Traceur, and adds a small deferred wrapper around it (which we're not sure we want to keep), and adds the ability to mock and synchronously flush the promise. I'm not sure how much we'll use this in Angular 2, it depends on how painful it is to test against native promise. Reply to this email directly or view it on GitHub: |
@benjamingr has thoughts on the deferred pattern I think the biggest argument for doing everything inside ES6 resolver fn is throw safety. E.g. something goes wrong inside, it gets handled by the promise's reject chain, whereas the deferred pattern leaves it up to the application to handle errors. |
@jeffcross I'm sorry but I don't understand the discussion. @kenbrubaker do you mind clarifying what you mean by Deferred? |
I just realized that "Jeff Cross" is not the most original name in the world. @jeffbcross, I think this was meant for you: @benjamingr said:
I apologize for chiming in. I was very confused but also didn't want to slow progress on this issue. -JC |
Ha, thanks other Jeff Cross @jeffcross |
Back to the original question, is this ready to be used? Can it be published on bower? |
Here's an article the explains the deferred object with references to the CommonJS Promises/A spec: The problem is that the ES6 spec only defines the promise object which makes it hard to multiplex. Sorry, I come from the .NET tradition and like my Task class. It looks from the reply from @jeffbcross that not having deferred is more "safe" since it is more likely to force people to call reject(). I like having Deferred() for libraries, where, of course, deferred.promise() is returned eventually. The problem is there doesn't seem to be a minimal ES6 extension out there that just adds Deferred. I'm hoping that angular/prophecy can be that repo. |
@kenbrubaker why do you think it makes it hard to multiplex? In C# you have to use |
@jeffbcross, will prophesy be used by Angular 2.0? Have you considered publishing on npm and bower? If not, can you suggest any other es6 promise complaint deferred implementation? It doesn't make sense to pull in traceur.
The text was updated successfully, but these errors were encountered: