Defer expression

dante federici c.dante.federici at
Sun Aug 20 18:40:50 UTC 2017

kai zhu has a good example of solving async order problems explicitly, as
opposed to banking on any defer or timeout to figure it out.

I'm a little curious of what you mean by "something that cannot run

If it can't be run immediately, then there should be *something* you can
hook into to run -- otherwise you're playing guesswork on what is currently
scheduled to execute.

Examples of the arbitrary use of "setTimeout" to defer to another script
frame in the DOM is when a frontend framework hasn't created elements yet,
and you need to run a query selector to grab them, or similar shenanigans.

I'd argue more that these are all anti patterns, since why should you be
guaranteed that toDoLater() can even be run after the setTimeout(1) or when
the Promise scheduler runs?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list