Defer expression

kai zhu kaizhu256 at gmail.com
Thu Aug 17 02:07:35 UTC 2017


setTimeout is still the best solution in my mind.  none of the promise
or async code examples presented are as immediately obvious as
setTimeout that the code is to self-run at a later time (and you don't
need the 1ms argument).

```js
// self-comment that this code will self-run
// after the main script in a reasonably immediate fashion
setTimeout(function () {
    // deferred code
})
```




On 8/17/17, Matthew Robb <matthewwrobb at gmail.com> wrote:
> I think this will actually get you what you're after:
>
> (async function () {
>
> await null;
> // Deferred code here
>
> })()
>
>
> On Aug 16, 2017 5:46 PM, "Darien Valentine" <valentinium at gmail.com> wrote:
>
> @logan ah, oops, that was an (incorrect) assumption about the proposed
> behavior on my part
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>


More information about the es-discuss mailing list