Skip to Main Content
Async JavaScript
book

Async JavaScript

by Trevor Burnham
November 2012
Intermediate to advanced content levelIntermediate to advanced
106 pages
2h 20m
English
Pragmatic Bookshelf
Content preview from Async JavaScript

Writing Async Functions

Every async function in JavaScript is built on some other async function(s). It’s async functions all the way down (to native code)!

The converse is also true: any function that uses an async function has to provide the result of that operation in an async way. As we learned from Blocking the Thread, JavaScript doesn’t provide a mechanism for preventing a function from returning until an async operation has finished. In fact, until the function returns, no async events will fire.

In this section, we’ll look at some common patterns in async function design. We’ll see that functions can be mercurial, deciding to be async only some of the time. But first, let’s define exactly what an async function is.

When Is a Function ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Modern Asynchronous JavaScript

Modern Asynchronous JavaScript

Faraz K. Kelhini
Learn TypeScript 3 by Building Web Applications

Learn TypeScript 3 by Building Web Applications

Sebastien Dubois, Alexis Georges

Publisher Resources

ISBN: 9781941222782Errata