4 ms·
I'd have to say Q promises (https://github.com/kriskowal/q https://github.com/kriskowal/q, adds promises to JS for much cleaner async code). Even though it's n
by beefsack 14y ago
I'd have to say Q promises (https://github.com/kriskowal/q https://github.com/kriskowal/q, adds promises to JS for much cleaner async code).
Even though it's not "cool" in the sense that it's very low level and doesn't do fancy UI stuff, my asynchronous code has become significantly cleaner and easier to maintain through using promises rather than having callback pyramids. The ability to wait for a number of promises to resolve before firing the next makes life so much easier too.
- Sephr 14y agoAnother library that tries to make async code much cleaner is async.js (https://github.com/eligrey/async.js#readme https://github.com/eligrey/async.js#readme). It uses yield and generators to abstract away the callback jungle. For example, you can easily condense tens of lines of event code into a single `event = yield document.next("click")`
- chadscira 14y agowhen.js is also pretty cool. I wrote a wrapper object for node that's been extremely useful https://github.com/icodeforlove/node-promise-object https://github.com/icodeforlove/node-promise-object
- paulocal 14y agoTHIS. I've been using this in my projects and it cuts a lot of work and makes my code way cleaner.