Defer expression

Naveen Chawla naveen.chwl at gmail.com
Thu Aug 17 06:03:31 UTC 2017


An in built `Promise` version of `setTimeout` would be cool:
`Promise.delay()` and `Promise.delay(500)`

On Thu, 17 Aug 2017, 7:37 a.m. kai zhu <kaizhu256 at gmail.com> wrote:

> 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
> >
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20170817/15672336/attachment.html>


More information about the es-discuss mailing list