are you bad, good, better or best with java script promises
DESCRIPTION
JS Channel NCR Meetup Talk on "How to use JavaScript Promises in the best way possible" by Apoorv Saxena. It talks about: * How to you score yourself in your current implementation of JavaScript Promises? * Being creative with JavaScript Promises * JavaScript Promises Implementation as defined in EcmaScript 6 specifications. Meetup: http://www.meetup.com/JSChannel-NCR/events/216101952/TRANSCRIPT
![Page 1: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/1.jpg)
LoversHey,
![Page 2: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/2.jpg)
I am Apoorv.
![Page 3: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/3.jpg)
I love writingBeautiful code.
![Page 4: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/4.jpg)
Let's get started.
![Page 5: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/5.jpg)
Are you Bad, Good,Better or Best with
JavaScriptPromises?
![Page 6: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/6.jpg)
But before that, let'splay a small game
![Page 7: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/7.jpg)
Game 1:
What are Promises?
Rules: There are no Rules.
![Page 8: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/8.jpg)
Take a moment to Congratulateyourself and others!!!
![Page 9: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/9.jpg)
Game 2:
How are you using
Promises?
![Page 10: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/10.jpg)
Game 3:
What do you understand, when you see....
BAD
GOODBETTER
BEST
![Page 11: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/11.jpg)
![Page 12: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/12.jpg)
History of Promises
![Page 13: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/13.jpg)
Why Promises?
![Page 14: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/14.jpg)
CallBack Hell
![Page 15: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/15.jpg)
Pyramid of Doom:
![Page 16: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/16.jpg)
Or writeSynchronous
JavaScript$.ajax({ url: "test.html", async: false }) console.log('This is how I write Synchronous JavaScript Code')
![Page 17: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/17.jpg)
![Page 18: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/18.jpg)
Handling ConcurrentAjax Calls
![Page 19: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/19.jpg)
Error handlingbecomes more
complicated
![Page 20: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/20.jpg)
Title Text
![Page 21: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/21.jpg)
Yes, I love Promises
But what now?
![Page 22: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/22.jpg)
“ Asynchronicityisn’t just for
concurrency, andpromises aren’t
just for XHR"
![Page 23: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/23.jpg)
Being creative withPromises
![Page 24: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/24.jpg)
Build UI Interactions
Different UI components communicatewith each other via Promises.
![Page 25: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/25.jpg)
Message Passingbetween iFrame and
Window
is a Request/Response based wrapper aroundthe PostMessage API that makes use of jQuery Promisesplease.js
![Page 26: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/26.jpg)
Increase Consistencyin Module Behavior
Using Promises to interact between two modules, willenable to retain the core logic of a module without
sharing its state with other dependent modules whilevalidating conditions or while applying their respective
logic.
![Page 27: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/27.jpg)
Wanna Migrate from jQuery?
Exception Handling
Chaining
Asynchrony
Single vs. Multiple Values
Deferreds, Promises, Resolvers
![Page 28: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/28.jpg)
What's new in ES6?Promises along with Generators and Iterators in going to be fun.Unifying asynchronous APIs ( fetch API is a promise-basedalternative to XMLHttpRequest)The for programmatically importing modulesis based on promises, tooPromises versus eventsPromises don't expose a progress api (e.g. to display a progressbar in a client-side user interface) :(
ECMAScript 6 API
![Page 29: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/29.jpg)
References:
(from You don'tknow JavaScript)
ES6 DraftChapter 3 - JavaScript Promises
General ResourcesLibrariesMigrating from jQueryUI Interactions via Promises
![Page 30: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/30.jpg)
There's no grading,it's all about
Learning
![Page 31: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/31.jpg)
Thanks!!!
![Page 32: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/32.jpg)
About Me:
Senior Software EngineerLove to Hack, Cook and Travel
![Page 33: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/33.jpg)
I've worked before in:
![Page 34: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/34.jpg)
and now working in:
![Page 35: Are you bad, good, better or best with java script promises](https://reader033.vdocuments.mx/reader033/viewer/2022060121/5594448f1a28ab01308b47de/html5/thumbnails/35.jpg)
Let's Connect..
LinkedIn: http://in.linkedin.com/in/saxenaapoorv
Google+: https://plus.google.com/+ApoorvSaxena/
Email: [email protected]