Promises/A+ - understanding the spec through implementation(modernjavascript.blogspot.com)
modernjavascript.blogspot.com
Promises/A+ - understanding the spec through implementation
http://modernjavascript.blogspot.com/2013/08/promisesa-understanding-by-doing.html
6 comments
Does anyone know if ES6's `yield` operator can potentially satisfy most of the goal of promises? It's still confusing after a while.
jQuery loosely follows the Promises/A spec [1], so Q.js [2] might have been better choice.
[1] http://domenic.me/2012/10/14/youre-missing-the-point-of-prom... [2] http://documentup.com/kriskowal/q/#
[1] http://domenic.me/2012/10/14/youre-missing-the-point-of-prom... [2] http://documentup.com/kriskowal/q/#
since jquery 1.8 they fixed the most outrageous limitation with their deferred implementation (then should return a new promise), and I actually prefer their implementation.
that said, i make use of underscore.deferred, which is the jquery implementation as an underscore mixin.
that said, i make use of underscore.deferred, which is the jquery implementation as an underscore mixin.
you can use core.async [1] on clojurescript right now to mitigate callback hell (or if you love go aync/channels)
[1] http://www.infoq.com/news/2013/07/core-async
[1] http://www.infoq.com/news/2013/07/core-async
I feel like promises are slowly becoming more accepted and widely used through the javascript community.
I know I didn't immediately see the point of them, and had to sit down and learn to use them properly before I was convinced.
I know I didn't immediately see the point of them, and had to sit down and learn to use them properly before I was convinced.
I found Async Javsacript by Trevor Burnham super helpful for learning how use promises properly. However, it doesn't cover the javascript implementation of a promise (uses jQuery), so this is a nice blog post complementing that material.
I was in the same boat until I ran into a problem that was perfectly solved by promises. Took a while to get to that point, though.
Another nice resource on implementing promises are the design documentation on Q (promise library) repository: https://github.com/kriskowal/q/blob/master/design/README.js
(HN discussion: https://news.ycombinator.com/item?id=4767941)
As a result, the code is hard to read because it doesn't flow sequentially.
Promises are a solution to that problem. They let you take something that would be callback hell and write it sequentially.
Keep in mind it's the blind leading the blind here. I just learned this term a month ago. Please correct me if I'm wrong.
That said, I found http://promises-aplus.github.io/promises-spec/#terminology to be more informative than the article itself (no offense)