Promise finally

Viktor Kronvall viktor.kronvall at gmail.com
Fri Feb 23 13:59:19 UTC 2018


Since these two Promises aren't chained to one another I wouldn't expect
any specific
deterministic ordering between the `console.log` statements. Are you
suggesting that
such a deterministic ordering should be imposed by using micro tasks or
what are you
proposing here exactly?

In other words, why exactly do you expect the result to always be printing
1 before
printing 2?

2018年2月23日(金) 19:21 Raul-Sebastian Mihăilă <raul.mihaila at gmail.com>:

> I find it weird that
>
> ```js
> Promise.resolve().finally(() => {}).then(() => { console.log(1); });
> Promise.resolve().then(() => {}).then(() => { console.log(2); });
> ```
>
> prints 2 and then 1. It would have been possible to spec it in such a way
> that it would have printed 1 and 2.
>
> On the other hand
>
> ```js
> Promise.resolve().finally().then(() => { console.log(1); });
> Promise.resolve().then().then(() => { console.log(2); });
> ```
>
> prints 1 and then 2.
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180223/e2ca2a84/attachment.html>


More information about the es-discuss mailing list