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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.