4 ms·
For those who didn't understand the new constructs, the following excerpt from TameJS[1] website helps: > `await` marks a section of code that depends on exter
by arocks 15y ago
For those who didn't understand the new constructs, the following excerpt from TameJS[1] website helps:
> `await` marks a section of code that depends on externals events, like network or disk activity, or a timer. An `await` block contains one or more calls to `defer`. Calling `defer` constructs a new deferral. Only once all deferrals inside an await block are fulfilled does control continue past it. `defer()` behaves much like a normal function; it returns an anonymous function that you give to your async functions. These functions "fulfill" their deferrals by calling the callbacks passed to them.
[1]: http://tamejs.org/ http://tamejs.org/