Quiz
Look back what we've gone throughQuiz
Callback Hell?
Inversion of control: don't have control over how many times your callback will be called and how (error first, etc.)
unreasonability: async code with callbacks doesn't flow the same way our brains work
We need higher-order patterns to address these issues. It's not about indentation and too many crying moustaches
What is a Promise
- future value. A completion event. (
.then
). It's a callback manager. They're designed with the trust in mind. How do you pause a generator?
yield
resume it: next
How do you combine generators and promises for flow control? Yielding a promises. And promise resumes the generator.