“I needed to change the flow of code and add some new features, but I found myself stuck. I couldn’t understand the code that I had written.” – Derick Bailey (yes, ME!)
Tired of writing deeply nested callback structures, only to realize later that you can't understand the control flow of the code? Looking for a better way to organize your asynchronous code, without callback hell
Enter, promises.
Promises provide a way to organize asynchronous JavaScript without creating “callback hell” or the “christmas tree of doom”. They provde structure and flow control to an otherwise messy codebase. They also allow you to register your callback functions whenever you want – even after the asynchronous code has already completed!
But you've looked at promises already, right? You've used them a few times – and with success! But you're still banging your head against a wall, stuck trying to understand what promises really do?
I understand. Really, I do. I re-invented this wheel by accident, before I realized what promises would do for me. And you know what? I'm glad I did! Building my own promises library was the best way for me to learn what they are, how they work and why we need them. And now you can benefit from this learning experience, too!
In less than 22 minutes, this screencast will teach you:
- how promises are are built and how they work behind the scenes
- how you can register callbacks after the async code returns
- how to register multiple callbacks, ensuring each is only called once
- how to pass data from the promise to the callbacks
You'll see the person behind the curtain and realize that it's not magic. You'll build a promise, from the ground up, to learn what they do and why. Come shatter the illusion of magic and reveal the simple and powerful API of promises by creating one for yourself!