CHAPTER 9

images

Using Promises

The basic premise of asynchronous programming in a Windows app is simple. You call a method and the work it performs is scheduled for later execution. At some point in the future, the work is performed and you are notified of the result by means of a callback function.

Asynchronous programming is well-established in JavaScript. You have probably already encountered asynchronous programming when you made an Ajax request in a web app. You wanted to load some content from the server, but didn’t want to prevent the user interacting with the app while this was happening. So, you made a method call using the XMLHttpRequest ...

Get Pro Windows 8 Development with HTML5 and JavaScript 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.