© Christopher Pitt 2018
Christopher PittThe Definitive Guide to AdonisJshttps://doi.org/10.1007/978-1-4842-3390-0_7

7. Promises

Christopher Pitt1 
(1)
Cape Town, Western Cape, South Africa
 

In the previous chapter, we learned about generators: how they work, and one or two things they can be useful for. We ended with a demonstration of building a multitasking system. In particular, we looked at how to use generators as interruptible functions. Other programming languages call this kind of function a coroutine (short for cooperative routine ), because it cooperates to allow for multitasking.

In the grand scheme of things, promises come before coroutines . They’re slightly harder to understand, though. They also don’t resolve (if you’ll pardon the pun) ...

Get The Definitive Guide to AdonisJs: Building Node.js Applications with JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.