Lesson 1: Asynchronous operations using jQuery and WinJS CHAPTER 9 403
■■The deferred object’s resolve and resolvewith methods indicate successful completion.
The deferred object’s reject and rejectwith methods indicate a failed operation. The
deferred object’s notify and notifywith methods update the progress.
■■The name of all functions that perform asynchronous calls should end with Async, and
these functions should always return a promise object.
■■Use the $.when() method to monitor the completion of many parallel asynchronous
calls. Use the $.when() method with no parameters to create a resolved promise object.
■■Chained and parallel asynchronous operations automatically pass failure and progress
to the end of the chain.
Lesson review
Answer the following questions to test your knowledge of the information in this lesson. You
can find the answers to these questions and explanations of why each answer choice is correct
or incorrect in the “Answers” section at the end of this chapter.
- Which method chains asynchronous operations?
A. pipe()
B. done()
C. resolve()
D. always() - Which method creates a resolved promise object?
A. resolve()
B. done()
C. $.when()
D. $.Deferred(). - Which method do you call to subscribe to the successful completion of an asynchro-
nous operation?
A. done
B. always
C. complete
D. success - Which method do you call on the deferred object to indicate a change in progress?
A. progress
B. notify
C. done
D. resolve