SlideShare a Scribd company logo
JavaScript Promises
Pulak (@pulakb)
http://pulakonline.com/
Discussions
• Callbacks
• JavaScript Promises
– jQuery
– ‘q’ library
– AngularJs
– Node.js
• What is a Callback function?
• How Callback function work?
• ‘Callback hell’
What is a Callback function?
• A callback function (say, Y) is a function that is passed to another function
(say, X) as a parameter, and Y gets executed inside X.
• JavaScript uses callback functions to handle asynchronous control flow.
1
2
3
$( "#dataRow" ).on( "click", function() {
alert(‘hello’);
});
How Callback function work?
function writeCode(callback) {
//do something
callback();
//…..
}
function introduceBugs() {
//…. Make bugs
}
writeCode(introduceBugs)
How Callback function work?
fs = require('fs');
fs.readFile ('f1.txt','utf8',function(err,data) {
if (err) {
return console.log(err);
}
console.log(data);
});
How Callback function work?
fs = require('fs');
fs.readFile('f1.txt','utf8',function(err,data){
if (err) {
return console.log(err);
}
console.log(data);
});
How Callback function work?
fs = require('fs');
fs.readFile('f1.txt','utf8',
function(err,data){
if (err) {
return console.log(err);
}
console.log(data);
}
);
Equivalent
formatting
‘Callback hell’
• Code complexity
• Modularity
• Maintainability
• Tightly coupled interface
‘Callback hell’
When working with callbacks, nesting of functions can make reading
and understanding the code very difficult
Promises
• What is Promise?
• What is Deferred?
• Deferred & Promise
• What are the use cases of Promise?
• What does Promises guarantee?
• Why promises are awesome?
What is Promise?
• A promise is an object that represents the return value or the
thrown exception that the function may eventually provide.
• In other words, a promise represents a value that is not yet known.
A promise is an asynchronous value.
• The core idea behind promises is that a promise represents the
result of an asynchronous operation.
• A Promise has 3 possible states
– Pending
– Fulfilled
– Rejected
Deferred & Promise
• A deferred (object) represents a work that is not yet finished.
• A promise (property) is a placeholder for a result which is initially
unknown.
• Every deferred has a promise which functions as a proxy for the future
result.
• From a semantic perspective this means that instead of calling a function
( callback ), we are able to return a value ( promise ).
JavaScript Promises
What are the use cases of Promise?
• An AJAX request and callbacks(a single request, parallel/chained requests)
• An asynchronous loading of assets and actions to perform
• Animation
• Modal User Interaction
What does Promise guarantee?
promiseForResult.then(onFulfilled, onRejected);
• Only one of onFulfilled or onRejected will be called.
• onFulfilled will be called with a single fulfillment value (⇔ return value).
• onRejected will be called with a single rejection reason (⇔ thrown
exception).
• If the promise is already settled, the handlers will still be called once you
attach them.
• The handlers will always be called asynchronously.
What does Promise guarantee?
• At first, a Promise is in a pending state. Eventually, it’s either resolved or
rejected.
• Once a Promise is resolved or rejected, it’ll remain in that state forever,
and its callbacks will never fire again
• Promises can be chained
Why promises are awesome
• Cleaner method signatures
• Uniform return/error semantics
• Easy composition
• Easy sequential/parallel join
• Always async
• Exception-style error bubbling
Case 1: Simple Functional Transform
var author = getAuthors();
var authorName = author.name;
// becomes
var authorPromise = getAuthors().then(function (author) {
return author.name;
});
Case 2: Reacting with an Exception
var author = getAuthors();
if (author === null)
throw new Error("null author!");
becomes
var authorPromise = getAuthors().then(function (author) {
if (author === null)
throw new Error("null author!");
return author;
});
Case 3: Handling an Exception
try {
updateAuthor(data);
} catch (ex) {
console.log("There was an error:", ex);
}
// becomes
var updatePromise = updateAuthor(data).then(undefined, function (ex) {
console.log("There was an error:", ex);
});
Case 4: Rethrowing an Exception
try {
updateAuthor(data);
} catch (ex) {
throw new Error("Updating author failed. Details: " + ex.message);
}
// becomes
var updatePromise = updateAuthor(data).then(undefined, function (ex) {
throw new Error("Updating author failed. Details: " + ex.message);
});
Async Case: Waiting
var name = promptForNewAuthorName();
updateAuthor({ name: name });
refreshScreen();
// becomes
promptForNewAuthorName()
.then(function (name) {
return updateAuthor({ name: name });
})
.then(refreshScreen);
jQuery
Q - library
Q - library
jQuery - q differences
• https://github.com/kriskowal/q/wiki/Coming-from-jQuery
jQuery Q Notes
then then
Q's then, and in fact all of its methods, have
different exception-handling behavior, as described
above.
done then
then does not support multiple handlers; use
multiple calls to then to attach them.
fail catch
catch does not support multiple handlers; use
multiple calls to catch to attach them.
deferred.promise(method) deferred.promise(property)
You *must* get the promise part of the deferred;
the deferred does not have the promise API.
Node and q library
AngularJS
AngularJS
– Limitations of Promise in Angular
In Angular's $Q implementation, If you don't fire off $scope.$apply(),
after resolving, the resolved values will never propagate to your 'then'
functions. Sometimes I want to use promises that aren't tied to my
Angular $digest cycle.
URLs
Credit goes to all the people for sharing their thoughts:
• http://wiki.commonjs.org/wiki/Promises/A
• http://promisesaplus.com/
• http://promisesaplus.com/differences-from-promises-a
• http://api.jquery.com/category/deferred-object/
• http://sitr.us/2012/07/31/promise-pipelines-in-javascript.html
• http://stackoverflow.com/questions/12160785/jquery-deferred-promise-design-patterns-and-use-cases
• http://stackoverflow.com/questions/6801283/what-are-the-differences-between-deferred-promise-and-future-in-javascript
• http://stackoverflow.com/questions/5436327/jquery-deferreds-and-promises-then-vs-done
• http://blog.mediumequalsmessage.com/promise-deferred-objects-in-javascript-pt1-theory-and-semantics
• https://gist.github.com/domenic/3889970
• http://domenic.me/2012/10/14/youre-missing-the-point-of-promises/
• https://github.com/kriskowal/q
• https://github.com/kriskowal/uncommonjs/blob/master/promises/specification.md
• http://james.padolsey.com/jquery/#v=2.0.3&fn=jQuery.Deferred
• http://www.dwmkerr.com/promises-in-angularjs-the-definitive-guide/
• http://spion.github.io/posts/why-i-am-switching-to-promises.html
• http://blog.ometer.com/2011/07/24/callbacks-synchronous-and-asynchronous/
Q &A

More Related Content

PDF
Asynchronous JavaScript Programming
Haim Michael
 
PPTX
Introduction to Node.js
Vikash Singh
 
PDF
JavaScript Fetch API
Xcat Liu
 
PPTX
Node.js Express
Eyal Vardi
 
PDF
Introduction to web programming with JavaScript
T11 Sessions
 
PPT
Introduction to JavaScript
Andres Baravalle
 
PPTX
JavaScript
Vidyut Singhania
 
PDF
JavaScript Promises
Derek Willian Stavis
 
Asynchronous JavaScript Programming
Haim Michael
 
Introduction to Node.js
Vikash Singh
 
JavaScript Fetch API
Xcat Liu
 
Node.js Express
Eyal Vardi
 
Introduction to web programming with JavaScript
T11 Sessions
 
Introduction to JavaScript
Andres Baravalle
 
JavaScript
Vidyut Singhania
 
JavaScript Promises
Derek Willian Stavis
 

What's hot (20)

PDF
The New JavaScript: ES6
Rob Eisenberg
 
PDF
NodeJS for Beginner
Apaichon Punopas
 
PDF
An introduction to React.js
Emanuele DelBono
 
PPTX
Introduction to React JS for beginners
Varun Raj
 
PPTX
[Final] ReactJS presentation
洪 鹏发
 
PPT
JavaScript Tutorial
Bui Kiet
 
PDF
Nodejs Explained with Examples
Gabriele Lana
 
PPTX
Lab #2: Introduction to Javascript
Walid Ashraf
 
PDF
Basics of JavaScript
Bala Narayanan
 
PPTX
Spring Boot and REST API
07.pallav
 
PPTX
ReactJS presentation.pptx
DivyanshGupta922023
 
PPT
Introduction to Javascript
Amit Tyagi
 
PDF
javascript objects
Vijay Kalyan
 
PPSX
Javascript variables and datatypes
Varun C M
 
PPS
Wrapper class
kamal kotecha
 
PDF
ReactJS presentation
Thanh Tuong
 
PPTX
Intro to React
Justin Reock
 
PPTX
Introduction to Node js
Akshay Mathur
 
PPTX
React hooks
Ramy ElBasyouni
 
The New JavaScript: ES6
Rob Eisenberg
 
NodeJS for Beginner
Apaichon Punopas
 
An introduction to React.js
Emanuele DelBono
 
Introduction to React JS for beginners
Varun Raj
 
[Final] ReactJS presentation
洪 鹏发
 
JavaScript Tutorial
Bui Kiet
 
Nodejs Explained with Examples
Gabriele Lana
 
Lab #2: Introduction to Javascript
Walid Ashraf
 
Basics of JavaScript
Bala Narayanan
 
Spring Boot and REST API
07.pallav
 
ReactJS presentation.pptx
DivyanshGupta922023
 
Introduction to Javascript
Amit Tyagi
 
javascript objects
Vijay Kalyan
 
Javascript variables and datatypes
Varun C M
 
Wrapper class
kamal kotecha
 
ReactJS presentation
Thanh Tuong
 
Intro to React
Justin Reock
 
Introduction to Node js
Akshay Mathur
 
React hooks
Ramy ElBasyouni
 
Ad

Viewers also liked (13)

PPTX
Promises, Promises
Domenic Denicola
 
PDF
JavaScript Promise
Joseph Chiang
 
PDF
Promises And Chaining In AngularJS - Into Callback Hell And Back Again
Hans-Gunther Schmidt
 
PDF
Callbacks, promises, generators - asynchronous javascript
Łukasz Kużyński
 
PDF
Sane Async Patterns
TrevorBurnham
 
PDF
JavaScript Promises
Tomasz Bak
 
PDF
Cloud Platform as a Service: Heroku
L&T Technology Services Limited
 
PDF
JavaScript Promises
우영 주
 
PDF
JavaScript - new features in ECMAScript 6
Solution4Future
 
PPTX
JavaScript Unit Testing
L&T Technology Services Limited
 
PDF
Pragmatics
JESSIE GRACE RUBRICO
 
PPTX
Speech acts
Carolina Celis
 
PPTX
Speech acts
Yirmanny
 
Promises, Promises
Domenic Denicola
 
JavaScript Promise
Joseph Chiang
 
Promises And Chaining In AngularJS - Into Callback Hell And Back Again
Hans-Gunther Schmidt
 
Callbacks, promises, generators - asynchronous javascript
Łukasz Kużyński
 
Sane Async Patterns
TrevorBurnham
 
JavaScript Promises
Tomasz Bak
 
Cloud Platform as a Service: Heroku
L&T Technology Services Limited
 
JavaScript Promises
우영 주
 
JavaScript - new features in ECMAScript 6
Solution4Future
 
JavaScript Unit Testing
L&T Technology Services Limited
 
Speech acts
Carolina Celis
 
Speech acts
Yirmanny
 
Ad

Similar to JavaScript Promises (20)

PDF
Avoiding callback hell with promises
TorontoNodeJS
 
PDF
Promises, Promises: Mastering Async I/O in Javascript with the Promise Pattern
Christian Lilley
 
PDF
Asynchronous JavaScript Programming with Callbacks & Promises
Hùng Nguyễn Huy
 
PPTX
The Promised Land (in Angular)
Domenic Denicola
 
PDF
Getting Comfortable with JS Promises
Asa Kusuma
 
PPTX
Java Script Promise
Alok Guha
 
PDF
Practical JavaScript Promises
Asa Kusuma
 
ODP
Promises, The Tao of Angular
vmlf
 
PDF
Introduction to Node JS2.pdf
Bareen Shaikh
 
PPTX
Avoiding callback hell in Node js using promises
Ankit Agarwal
 
PPT
You promise?
IT Weekend
 
PDF
Async js - Nemetschek Presentaion @ HackBulgaria
HackBulgaria
 
PDF
Asynchronous development in JavaScript
Amitai Barnea
 
PPTX
Async discussion 9_29_15
Cheryl Yaeger
 
PDF
JavaScript promise
eslam_me
 
PDF
Promises - The Unsung Heroes ofJavaScript
Dean Radcliffe
 
PDF
4 mishchevskii - testing stage18-
Ievgenii Katsan
 
PDF
Asynchronous JavaScript and Promises
Senthil Kumar
 
ZIP
Promises in JavaScript with jQuery
Ryan Blunden
 
PDF
Boom! Promises/A+ Was Born
Domenic Denicola
 
Avoiding callback hell with promises
TorontoNodeJS
 
Promises, Promises: Mastering Async I/O in Javascript with the Promise Pattern
Christian Lilley
 
Asynchronous JavaScript Programming with Callbacks & Promises
Hùng Nguyễn Huy
 
The Promised Land (in Angular)
Domenic Denicola
 
Getting Comfortable with JS Promises
Asa Kusuma
 
Java Script Promise
Alok Guha
 
Practical JavaScript Promises
Asa Kusuma
 
Promises, The Tao of Angular
vmlf
 
Introduction to Node JS2.pdf
Bareen Shaikh
 
Avoiding callback hell in Node js using promises
Ankit Agarwal
 
You promise?
IT Weekend
 
Async js - Nemetschek Presentaion @ HackBulgaria
HackBulgaria
 
Asynchronous development in JavaScript
Amitai Barnea
 
Async discussion 9_29_15
Cheryl Yaeger
 
JavaScript promise
eslam_me
 
Promises - The Unsung Heroes ofJavaScript
Dean Radcliffe
 
4 mishchevskii - testing stage18-
Ievgenii Katsan
 
Asynchronous JavaScript and Promises
Senthil Kumar
 
Promises in JavaScript with jQuery
Ryan Blunden
 
Boom! Promises/A+ Was Born
Domenic Denicola
 

Recently uploaded (20)

PPTX
The Latest Scam Shocking the USA in 2025.pptx
onlinescamreport4
 
PPT
Transformaciones de las funciones elementales.ppt
rirosel211
 
PPTX
Black Yellow Modern Minimalist Elegant Presentation.pptx
nothisispatrickduhh
 
PPTX
B2B_Ecommerce_Internship_Simranpreet.pptx
LipakshiJindal
 
PPTX
Parallel & Concurrent ...
yashpavasiya892
 
PPTX
办理方法西班牙假毕业证蒙德拉贡大学成绩单MULetter文凭样本
xxxihn4u
 
PDF
5g is Reshaping the Competitive Landscape
Stellarix
 
PPTX
ENCOR_Chapter_11 - ‌BGP implementation.pptx
nshg93
 
PDF
BGP Security Best Practices that Matter, presented at PHNOG 2025
APNIC
 
PPTX
EthicalHack{aksdladlsfsamnookfmnakoasjd}.pptx
dagarabull
 
PPTX
Crypto Recovery California Services.pptx
lionsgate network
 
PDF
Centralized Business Email Management_ How Admin Controls Boost Efficiency & ...
XgenPlus Technologies
 
PPTX
LESSON-2-Roles-of-ICT-in-Teaching-for-learning_123922 (1).pptx
renavieramopiquero
 
PDF
Cybersecurity Awareness Presentation ppt.
banodhaharshita
 
PPTX
Unlocking Hope : How Crypto Recovery Services Can Reclaim Your Lost Funds
lionsgate network
 
PPTX
原版北不列颠哥伦比亚大学毕业证文凭UNBC成绩单2025年新版在线制作学位证书
e7nw4o4
 
PDF
KIPER4D situs Exclusive Game dari server Star Gaming Asia
hokimamad0
 
PDF
PDF document: World Game (s) Great Redesign.pdf
Steven McGee
 
PDF
Project English Paja Jara Alejandro.jpdf
AlejandroAlonsoPajaJ
 
PPTX
Perkembangan Perangkat jaringan komputer dan telekomunikasi 3.pptx
Prayudha3
 
The Latest Scam Shocking the USA in 2025.pptx
onlinescamreport4
 
Transformaciones de las funciones elementales.ppt
rirosel211
 
Black Yellow Modern Minimalist Elegant Presentation.pptx
nothisispatrickduhh
 
B2B_Ecommerce_Internship_Simranpreet.pptx
LipakshiJindal
 
Parallel & Concurrent ...
yashpavasiya892
 
办理方法西班牙假毕业证蒙德拉贡大学成绩单MULetter文凭样本
xxxihn4u
 
5g is Reshaping the Competitive Landscape
Stellarix
 
ENCOR_Chapter_11 - ‌BGP implementation.pptx
nshg93
 
BGP Security Best Practices that Matter, presented at PHNOG 2025
APNIC
 
EthicalHack{aksdladlsfsamnookfmnakoasjd}.pptx
dagarabull
 
Crypto Recovery California Services.pptx
lionsgate network
 
Centralized Business Email Management_ How Admin Controls Boost Efficiency & ...
XgenPlus Technologies
 
LESSON-2-Roles-of-ICT-in-Teaching-for-learning_123922 (1).pptx
renavieramopiquero
 
Cybersecurity Awareness Presentation ppt.
banodhaharshita
 
Unlocking Hope : How Crypto Recovery Services Can Reclaim Your Lost Funds
lionsgate network
 
原版北不列颠哥伦比亚大学毕业证文凭UNBC成绩单2025年新版在线制作学位证书
e7nw4o4
 
KIPER4D situs Exclusive Game dari server Star Gaming Asia
hokimamad0
 
PDF document: World Game (s) Great Redesign.pdf
Steven McGee
 
Project English Paja Jara Alejandro.jpdf
AlejandroAlonsoPajaJ
 
Perkembangan Perangkat jaringan komputer dan telekomunikasi 3.pptx
Prayudha3
 

JavaScript Promises

  • 2. Discussions • Callbacks • JavaScript Promises – jQuery – ‘q’ library – AngularJs – Node.js
  • 3. • What is a Callback function? • How Callback function work? • ‘Callback hell’
  • 4. What is a Callback function? • A callback function (say, Y) is a function that is passed to another function (say, X) as a parameter, and Y gets executed inside X. • JavaScript uses callback functions to handle asynchronous control flow. 1 2 3 $( "#dataRow" ).on( "click", function() { alert(‘hello’); });
  • 5. How Callback function work? function writeCode(callback) { //do something callback(); //….. } function introduceBugs() { //…. Make bugs } writeCode(introduceBugs)
  • 6. How Callback function work? fs = require('fs'); fs.readFile ('f1.txt','utf8',function(err,data) { if (err) { return console.log(err); } console.log(data); });
  • 7. How Callback function work? fs = require('fs'); fs.readFile('f1.txt','utf8',function(err,data){ if (err) { return console.log(err); } console.log(data); });
  • 8. How Callback function work? fs = require('fs'); fs.readFile('f1.txt','utf8', function(err,data){ if (err) { return console.log(err); } console.log(data); } ); Equivalent formatting
  • 9. ‘Callback hell’ • Code complexity • Modularity • Maintainability • Tightly coupled interface
  • 10. ‘Callback hell’ When working with callbacks, nesting of functions can make reading and understanding the code very difficult
  • 11. Promises • What is Promise? • What is Deferred? • Deferred & Promise • What are the use cases of Promise? • What does Promises guarantee? • Why promises are awesome?
  • 12. What is Promise? • A promise is an object that represents the return value or the thrown exception that the function may eventually provide. • In other words, a promise represents a value that is not yet known. A promise is an asynchronous value. • The core idea behind promises is that a promise represents the result of an asynchronous operation. • A Promise has 3 possible states – Pending – Fulfilled – Rejected
  • 13. Deferred & Promise • A deferred (object) represents a work that is not yet finished. • A promise (property) is a placeholder for a result which is initially unknown. • Every deferred has a promise which functions as a proxy for the future result. • From a semantic perspective this means that instead of calling a function ( callback ), we are able to return a value ( promise ).
  • 15. What are the use cases of Promise? • An AJAX request and callbacks(a single request, parallel/chained requests) • An asynchronous loading of assets and actions to perform • Animation • Modal User Interaction
  • 16. What does Promise guarantee? promiseForResult.then(onFulfilled, onRejected); • Only one of onFulfilled or onRejected will be called. • onFulfilled will be called with a single fulfillment value (⇔ return value). • onRejected will be called with a single rejection reason (⇔ thrown exception). • If the promise is already settled, the handlers will still be called once you attach them. • The handlers will always be called asynchronously.
  • 17. What does Promise guarantee? • At first, a Promise is in a pending state. Eventually, it’s either resolved or rejected. • Once a Promise is resolved or rejected, it’ll remain in that state forever, and its callbacks will never fire again • Promises can be chained
  • 18. Why promises are awesome • Cleaner method signatures • Uniform return/error semantics • Easy composition • Easy sequential/parallel join • Always async • Exception-style error bubbling
  • 19. Case 1: Simple Functional Transform var author = getAuthors(); var authorName = author.name; // becomes var authorPromise = getAuthors().then(function (author) { return author.name; });
  • 20. Case 2: Reacting with an Exception var author = getAuthors(); if (author === null) throw new Error("null author!"); becomes var authorPromise = getAuthors().then(function (author) { if (author === null) throw new Error("null author!"); return author; });
  • 21. Case 3: Handling an Exception try { updateAuthor(data); } catch (ex) { console.log("There was an error:", ex); } // becomes var updatePromise = updateAuthor(data).then(undefined, function (ex) { console.log("There was an error:", ex); });
  • 22. Case 4: Rethrowing an Exception try { updateAuthor(data); } catch (ex) { throw new Error("Updating author failed. Details: " + ex.message); } // becomes var updatePromise = updateAuthor(data).then(undefined, function (ex) { throw new Error("Updating author failed. Details: " + ex.message); });
  • 23. Async Case: Waiting var name = promptForNewAuthorName(); updateAuthor({ name: name }); refreshScreen(); // becomes promptForNewAuthorName() .then(function (name) { return updateAuthor({ name: name }); }) .then(refreshScreen);
  • 27. jQuery - q differences • https://github.com/kriskowal/q/wiki/Coming-from-jQuery jQuery Q Notes then then Q's then, and in fact all of its methods, have different exception-handling behavior, as described above. done then then does not support multiple handlers; use multiple calls to then to attach them. fail catch catch does not support multiple handlers; use multiple calls to catch to attach them. deferred.promise(method) deferred.promise(property) You *must* get the promise part of the deferred; the deferred does not have the promise API.
  • 28. Node and q library
  • 30. AngularJS – Limitations of Promise in Angular In Angular's $Q implementation, If you don't fire off $scope.$apply(), after resolving, the resolved values will never propagate to your 'then' functions. Sometimes I want to use promises that aren't tied to my Angular $digest cycle.
  • 31. URLs Credit goes to all the people for sharing their thoughts: • http://wiki.commonjs.org/wiki/Promises/A • http://promisesaplus.com/ • http://promisesaplus.com/differences-from-promises-a • http://api.jquery.com/category/deferred-object/ • http://sitr.us/2012/07/31/promise-pipelines-in-javascript.html • http://stackoverflow.com/questions/12160785/jquery-deferred-promise-design-patterns-and-use-cases • http://stackoverflow.com/questions/6801283/what-are-the-differences-between-deferred-promise-and-future-in-javascript • http://stackoverflow.com/questions/5436327/jquery-deferreds-and-promises-then-vs-done • http://blog.mediumequalsmessage.com/promise-deferred-objects-in-javascript-pt1-theory-and-semantics • https://gist.github.com/domenic/3889970 • http://domenic.me/2012/10/14/youre-missing-the-point-of-promises/ • https://github.com/kriskowal/q • https://github.com/kriskowal/uncommonjs/blob/master/promises/specification.md • http://james.padolsey.com/jquery/#v=2.0.3&fn=jQuery.Deferred • http://www.dwmkerr.com/promises-in-angularjs-the-definitive-guide/ • http://spion.github.io/posts/why-i-am-switching-to-promises.html • http://blog.ometer.com/2011/07/24/callbacks-synchronous-and-asynchronous/
  • 32. Q &A