Alternative to Promise
handong05 at meituan.com
Thu Oct 1 00:07:42 UTC 2015
It seems not a lot of people understand what’s a Promise, please read these:
The design of Q: https://github.com/kriskowal/q/tree/v1/design <https://github.com/kriskowal/q/tree/v1/design>
The difference between Action and Promise: https://github.com/winterland1989/Action.js/wiki/Difference-from-Promise <https://github.com/winterland1989/Action.js/wiki/Difference-from-Promise>
tl;dr, Promise use an internal state, an pending callback queue to save callbacks during pending, and after pending, the resolved value are saved.
Action is just continuation in other FP languages, which is a simple object just have a single field point to the continuation.
Any question are welcomed.
> On Sep 30, 2015, at 8:36 PM, Thomas <thomasjamesfoster at bigpond.com> wrote:
> From what I can tell, Action.js seems to wrap callback-based APIs with something called an `Action` which does what a promise does but with a different API. Is there any other intended functionality that I'm missing?
> I'm not sure what the point of the Action class is - Promise does pretty much all Action does, plus it's standard and will work with async/await functions. The small size of the Action.js library isn't really that important if you're in a browser that has promises built in.
> I'm not really sure how error handling works in Action.js - it's not really that confusing to pass a second callback to .then or to use .catch. Plus, it looks as though the code throws uncaught errors in a synchronous way, even though the code is asynchronous. That's more confusing, not less.
> In the end, Action.js seems to provide no real advantage over just using built in promises and wrapping legacy APIs that don't use promises. Plus, using a completely different API and incomparable API to promises is a bit of a pain.
> On 30 Sep 2015, at 3:51 PM, 韩冬 <handong05 at meituan.com <mailto:handong05 at meituan.com>> wrote:
>> ES6 Promise is great, i just want to share my thoughts on dealing with callback hell issue with a different approach here.
>> http://winterland1989.github.io/Action.js/ <http://winterland1989.github.io/Action.js/>
>> I’m not saying it’s better than Promise, but it’s much simpler and easier IMO, any peer are welcomed!
>> es-discuss mailing list
>> es-discuss at mozilla.org <mailto:es-discuss at mozilla.org>
>> https://mail.mozilla.org/listinfo/es-discuss <https://mail.mozilla.org/listinfo/es-discuss>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss