synchronous flows are easy ...
Blocking is easy :D
synchronous flows are easy ...
but we don't want to block!
we want to Wait.
The Promise object represents the eventual completion (or failure) of an asynchronous operation, and its resulting value.
Promise chain - HELL
Cons:
Pros:
Overview:
Generator functions
A generator is a function that can return multiple values.
Generator functions
to the code!
Generator - split personality
Generator - the untapped power
Generator - the untapped power
Async - wirting code that looks like it blocks but it actually waits.
What I want
What We have :)
Async - is this the promise land ?
Async - maybe ?! async I/O
2. we can't use async within an async function
go to code!
1. we can't use async for flows that require parallel requests
Overview:
Callbacks
They are everywhere (the backbone of asynchronous in javascript).
Hard to reason complex flows that are written using only callbacks.
Promise
They simplify and standardise asynchronous flows and add some sanity to the relation between our code and 3 parties.
Still hard to reason when the flows are to complex.
Async
Easy to reason about - but can't work with flows that require parallel requests.