Chapter 9. Asynchronous operations

Have you ever run an application and had the screen freeze when you clicked a button? You waited until its operation completed, and then the application started working again. Have you seen this behavior on webpages? You know that the problem is due to long-running operations, but shouldn’t there be a better way to write this code?

The answer to these questions is to implement long-running operations as asynchronous operations because these operations are currently synchronous operations. Synchronous code has one sequential execution path, and when the long-running code is executing, nothing else can be accomplished. What’s needed is another execution path so that the long-running code can execute on one execution ...

Get Training Guide: Programming in HTML5 with JavaScript and CSS3 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.