Re: Do settled promise chain handlers fire in the same turn?

2017-02-26 Thread T.J. Crowder
On Sun, Feb 26, 2017 at 7:49 PM, /#!/JoePea wrote: > > Thanks T.J., that explains it well. Glad that helped! > I asked because I'm working with synchronous tests, so I'm wondering > how to resolve ES6 Promises with fake network data synchronously, > and fire all the handlers

Re: Do settled promise chain handlers fire in the same turn?

2017-02-26 Thread /#!/JoePea
Thanks T.J., that explains it well. I asked because I'm working with synchronous tests, so I'm wondering how to resolve ES6 Promises with fake network data synchronously, and fire all the handlers synchronously, all within the synchronous test function. Any recommendation on that? */#!/*JoePea

Re: Do settled promise chain handlers fire in the same turn?

2017-02-25 Thread T.J. Crowder
On Sat, Feb 25, 2017 at 7:22 PM, /#!/JoePea wrote: > I'm not sure what's the best way to phrase the subject (please advise on the terminology) Re terminology: I think you mean, will they all fire in the same job? (More on jobs and job queues:

Do settled promise chain handlers fire in the same turn?

2017-02-25 Thread Raul-Sebastian Mihăilă
In your example there are 7 promises. 1) `p` 2) `Promise.resolve(console.log('A'))` 3) the promise returned by the first `then` call 4) `Promise.resolve(console.log('B'))` 5) the promise returned by the second `then` call 6) Promise.resolve(console.log('C')) 7) the promise returned by the third

Do settled promise chain handlers fire in the same turn?

2017-02-25 Thread /#!/JoePea
I'm not sure what's the best way to phrase the subject (please advise on the terminology), but for example, if we have a promise chain ```js const p = new Promise(r => setTimeout(r, 100)) p .then(() => Promise.resolve(console.log('A'))) .then(() => Promise.resolve(console.log('B'))) .then(() =>