Asynchronous programming with Promise objects
When building a Windows 8 app, the stress is on having a responsive UI, which is one of the main characteristics of a Windows 8 Store app. In Chapter 2, Styling with CSS3, we got to see how we can achieve that at the styling level. The responsive UI also includes having a responsive functionality whereby the code running behind the scenes not only blocks the app's UI all of a sudden but also makes it unresponsive to any user input while some logic or functionality executes.
JavaScript, as a programming language, is single-threaded, which means that a synchronous execution of a long-running process will block all other executions until that process has completed. Thus, you should avoid synchronous execution whenever you can. The solution to this predicament is asynchronous processing, which is essential to create responsive, high-performance apps. One way of achieving asynchronous processing is by using the callback function mechanism. A callback...