Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Learning jQuery Deferreds
Preface
About You
Our Aims
Challenges
jQuery Deferreds
Our JavaScript Coding Style, or Lack Thereof
Conventions Used in This Book
Using Code Examples
Safari® Books Online
How to Contact Us
Acknowledgments
1. Introduction
Food for Thought
Terminology: Deferreds and Promises
Familiar Promises
2. The jQuery Deferred API
Consuming Promises
More Terminology: Resolve, Reject and Progress
done
fail
always
progress
promise
then
state
when
Creating Deferreds
Construction
resolve and resolveWith
reject and rejectWith
notify and notifyWith
Putting It All Together
Deferred Dynamics
Deprecated Promise Methods
isRejected and isResolved
pipe
Changes in the jQuery Deferred API
3. Deferred Recipes
A Replacement for the setTimeout Function
Challenges
Messaging in Chrome Extensions
Challenges
Accessing Chrome Local Storage
Challenges
Running Promise-Returning Functions One by One
Challenges
A Promise Pool with an emptyPromise Method
Creating a Promise Pool
Using the Promise Pool
Challenges
Displaying Google Maps
Challenges
Communicating with a Web Worker
The Web Worker Code
Creating a Web Worker
Using It
Summary
Challenges
Using Web Sockets
The Web Socket Server
The Web Socket Client
Challenges
Automatically Retrying Failing Deferred Calls
Challenges
Memoization
Discussion
Avoiding the Dogpile Effect
Challenges
Short-Term Memoization of In-Progress Function Calls
createUser Is Not Idempotent
Challenges
Streaming Promise Events
Delivering More Information
Delegating the Event Stream
To Be Continued…
Challenges
Getting the First Result from a Set of Promises
Which Promise Fired?
A Fly in the Soup
delegateEventStream Redux
Challenges
A Deferred Queue
Challenges
when2: An Improved jQuery.when
Using when2 to Time Out a Single Promise
Differences from $.when
Challenges
Timing Out Promises
Challenges
Controlling Your Own Destiny
Challenges
Deactivating a Promise
Challenges
4. More Time in the Mental Gymnasium
Do You Really Understand jQuery Deferreds?
Promises/A+
Promises Are First-Class Objects for Function Calls
Asynchronous Data Structures
Advantages of Deferreds
Difficulties with Deferreds
Further Reading
A. Hints for Selected Challenges
A Replacement for the setTimeout Function
Messaging in Chrome Extensions
Accessing Chrome Local Storage
Running Promise-Returning Functions One by One
A Promise Pool with an emptyPromise Method
Displaying Google Maps
Communicating with a Web Worker
Using Web Sockets
Automatically Retrying Failing Deferred Calls
Memoization
Short-Term Memoization of In-Progress Function Calls
Streaming Promise Events
Getting the First Result from a Set of Promises
A Deferred Queue
when2: An Improved jQuery.when
Timing Out Promises
Controlling Your Own Destiny
Deactivating a Promise
B. The Promises/A+ Specification
Terminology
Requirements
Promise States
The then Method
The Promise Resolution Procedure
C. Converting an ArrayBuffer to Base 64
Colophon
Copyright
← Prev
Back
Next →
← Prev
Back
Next →