Progress Notifications

A Promise is a bundle of things you want to happen when a process comes to an end. But didn’t a motivational poster once tell you that the journey is as important as the destination? Did you learn nothing from that poster?

Fortunately, the jQuery team soaked up that wisdom (and the Promises/A specification) and, in jQuery 1.7, added a new kind of Promise callback that can be invoked any number of times. It’s called progress. For example, suppose we want to update an indicator of how far a person has gotten toward their daily word goal for National Novel Writing Month (NaNoWriMo).[34]

​ 
​var​ nanowrimoing = $.Deferred();
​ 
​var​ wordGoal = 5000;
​ 
nanowrimoing.progress(​function​(wordCount) {
​ ...

Get Async 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.