O'Reilly logo

JavaScript Promises Essentials by Rami Sarieddine

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Explaining the WinJS.Promise object

This object is one of the most important aspects of the WinJS library, and instances of promise are involved with anything we do with asynchronous APIs. Let us dive into the details of this object. In terms of anatomy, the promise object includes the following three types of members.

Constructors

At the level of constructors in WinJS, a class is created using the WinJS.Class.define function. In this first parameter is a function that acts as the constructor. Now, in the case of the Promise class, it is derived from a base class called PromiseStateMachine using the WinJS.Class.derive function, whose second parameter is the constructor function. In both cases, constructor functions can be named anything; alternatively, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required