On Fri, Feb 24, 2017 at 5:18 AM, Šime Vidas wrote:
> To clarify, the idea is to declare and kick off all the concurrent tasks
> upfront (using local variables and the ‘lazy await’ keyword), and then just
> continue writing the rest of the code ‘as if all the promises are
>
On 24 February 2017 at 16:19:03, Šime Vidas (sime.vi...@gmail.com) wrote:
> To clarify, the idea is to declare and kick off all the concurrent tasks
> upfront
Well, that's what promises *already* do, even without using the
`async` and `await` keywords. You kick off all concurrent tasks
up-front
So you'd be imagining something that would create a variable that would
automatically await when accessed, like
```
async function makePizza(sauceType = 'red') {
await const dough = makeDough();
await const sauce = makeSauce(sauceType);
await const cheese =
To clarify, the idea is to declare and kick off all the concurrent tasks
upfront (using local variables and the ‘lazy await’ keyword), and then just
continue writing the rest of the code ‘as if all the promises are
resolved’. The async function automagically pauses whenever needed, so it’s
no
Hi,
Converting an arbitray value to a number in JS can be rather
inconsistent and unexpected:
* `null` and `undefined` are different: `+null === 0` but `+undefined`
is NaN.
* Empty string and non-nubmeric strings are different: `+"" === 0` but
`+"foo"` is NaN.
This problem can be
We already have that feature in the language: it’s called await. Just rewrite
the example like so, instead of using /* pause to await x */ comments:
async function makePizza(sauceType = 'red') {
let dough = makeDough();
let sauce = await makeSauce(sauceType);
let cheese =
Daniel Brain from PayPal has written a post about async/await:
https://medium.com/@bluepnume/even-with-async-await-you-probably-still-need-promises-9b259854c161
It revolves around writing an async function which would execute three
tasks in parallel like so:
|- dough ->
|
7 matches
Mail list logo