> Le 29 nov. 2019 à 21:05, Lars Eidnes <[email protected]> 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:

https://github.com/whatwg/html/issues/617 
<https://github.com/whatwg/html/issues/617>


> 
> 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.

—Claude
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to