The current (and likely final) async/await proposal awaits promises and desugars into something like bluebird's Promise.coroutine
with await
playing the part of yield
.
This makes sense, as promises represent a value + time and you're waiting for that value to become available. Note await
also waits for promise like constructs in all other languages that include it like C# or Python (3.5+) .
Note that converting callback APIs to promises is very easy, and some libraries offer tools to do so in a single command. See How to convert an existing callback API to promises for more details.