claude.pache at gmail.com
Mon Dec 2 09:15:30 UTC 2019
> Le 29 nov. 2019 à 21:05, Lars Eidnes <larseidnes at gmail.com> a écrit :
> 1) Is it a good idea to introduce an alternative to setTimeout, where the distinction is that it returns a Promise, and that return/throw in the callback take the role of resolve/reject?
I think so (although there is no need keep the callback). But since setTimeout() is not part of ECMAScript proper, this is not the proper place to discuss it. See rather:
> 2) Are there other things we could do to minimize the need for resolve/reject?
I don’t think there is anything to do at the core language level, because it has already the necessary tools (async/await). Rather, new APIs ought to be designed in order to be directly usable with `await`, i.e., they ought to return a Promise instead of taking a callback or having an event-handler. F.e., the old XMLHttpRequest API shall be replaced with the new Fetch API.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss