A promise that resolves after a delay.

Isiah Meadows isiahmeadows at gmail.com
Fri Feb 5 19:36:56 UTC 2016


I'd agree that we don't need `Promise.p.wait`, but I think eventually, ES
is going to need a spec for an event loop. Or at least an interoperable
spec agnostic of runtime should be created somewhere, like the eventual
module loader.

On Thu, Feb 4, 2016, 19:20 Jan-Ivar Bruaroey <jib at mozilla.com> wrote:

> On 2/3/16 11:39 PM, Bob Myers wrote:
> > Promise.resolve(42) . then(wait(1000)) . then( /* cb */);
>
> With ES6 I prefer the straightforward:
>
>      var wait = ms => new Promise(resolve => setTimeout(resolve, ms));
>
>      Promise.resolve(42) . then(() => wait(1000)).then(() => { /* cb */ });
>
>   Too simple to standardize IMHO.
>
> .: Jan-Ivar :.
>
> _______________________________________________
> 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/20160205/9bf29cc1/attachment.html>


More information about the es-discuss mailing list