Defer expression

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Defer expression

Karl Thunberg
Hi, is there any proposal for an expression to invoke something after the current call stack has cleared? Lodash `defer` is a good example.

Just like I can use `await` to pause the execution of the current call, it would be nice to also have an expression to queue up something that cannot run immediately e.g. `defer doThisLater();`

The current solution is to use `setTimeout` with a 1 ms delay but that is not a good solution as it is not the same thing and it makes it more difficult for people to understand what is the true purpose of that line of code.

es-discuss mailing list
[hidden email]