Lovers Hey,
Jul 02, 2015
LoversHey,
I am Apoorv.
I love writingBeautiful code.
Let's get started.
Are you Bad, Good,Better or Best with
JavaScriptPromises?
But before that, let'splay a small game
Game 1:
What are Promises?
Rules: There are no Rules.
Take a moment to Congratulateyourself and others!!!
Game 2:
How are you using
Promises?
Game 3:
What do you understand, when you see....
BAD
GOODBETTER
BEST
History of Promises
Why Promises?
CallBack Hell
Pyramid of Doom:
Or writeSynchronous
JavaScript$.ajax({ url: "test.html", async: false }) console.log('This is how I write Synchronous JavaScript Code')
Handling ConcurrentAjax Calls
Error handlingbecomes more
complicated
Title Text
Yes, I love Promises
But what now?
“ Asynchronicityisn’t just for
concurrency, andpromises aren’t
just for XHR"
Being creative withPromises
Build UI Interactions
Different UI components communicatewith each other via Promises.
Message Passingbetween iFrame and
Window
is a Request/Response based wrapper aroundthe PostMessage API that makes use of jQuery Promisesplease.js
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.
Wanna Migrate from jQuery?
Exception Handling
Chaining
Asynchrony
Single vs. Multiple Values
Deferreds, Promises, Resolvers
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
References:
(from You don'tknow JavaScript)
ES6 DraftChapter 3 - JavaScript Promises
General ResourcesLibrariesMigrating from jQueryUI Interactions via Promises
There's no grading,it's all about
Learning
Thanks!!!
About Me:
Senior Software EngineerLove to Hack, Cook and Travel
I've worked before in:
and now working in:
Let's Connect..
LinkedIn: http://in.linkedin.com/in/saxenaapoorv
Google+: https://plus.google.com/+ApoorvSaxena/
Email: [email protected]