Jafar Husain: Async Programming in ES7 | JSConf US 2015

JSConf · 63K views · 2015 · 32:57

Open on YouTube

Web developmentProgramming language designtalkdated

Why Stack Overflow recommends it

Stack Overflow users link it when explaining that callback-free async code is coming to JavaScript with async/await and async iteration, often as a follow-up to promise questions.

Recommended by 2 people across 2 different months, 2015 to 2016.

What it is

A JSConf US 2015 conference talk by Jafar Husain on proposed ES7 async features, including async functions, await, and async generators that let developers handle streams, web sockets and errors without callbacks. It walks through how these proposals would replace callback pyramids with ordinary loops and try/catch.

What people said

Recommends Nathan · 2015-07 · Stack Overflow · on “Assign value from successful promise resolve to external variable”

You are going to get whatever then() returns. But since you are reading this, the following may help you: Your statement does nothing more than ask the interpreter to assign the value returned from then() to the vm.feed variable. then() returns you a Promise (as you can see here: [LINK] ). You could picture this by seeing that the Promise (a simple object) is being pulled out of the function and getting assigned to vm.feed . This happens as soon as the interpreter executes that line. Since your successful callback does not run when you call then() but only when your promise gets resolved (at a later time, asynchronously) it would be impossible for then() to return its value for the caller. T

Recommends Nathan · 2015-07 · Stack Overflow · on “Assign value from successful promise resolve to external variable”

FYI what you are trying to achieve will be available in ES2016 with the `await` keyword. In case you are interested: [this video] :)

Recommends user2727195 · 2016-07 · Stack Overflow · on “Promise Retry Design Patterns”

@jfriend00 this helped me a lot in refining what I was looking for. [this video] a combination of AsyncIterator and Observer pattern

Cites vlad-ardelean · 2016-01 · Stack Overflow · on “Is this magic about iterators only, or is this a more general underlying thing?”

I saw this talk (specific timing is intentional [this video] On the board there's this piece of code (a similar one actually): var it = [8,9 0][Symbol.iterator]() //This gives me an ArrayIterator{...} I noticed that if I try to do it in 2 steps, in Chrome, it fails: var nums = [9,8,7] var it = nums[Symbol.iterator] it = it() // in the console, this throws 'Uncaught TypeError: Cannot convert undefined or null to object(…)' Almost knowing some javascript, I noticed that if I do var it = nums[Symbol.iterator] it.apply(nums) // I again get the ArrayIterator What's this magic about? What's so different between var x = obj[method]() and var x = obj[method]; x = x()