`setTimeout` it is defined in the HTML spec,
https://www.w3.org/TR/html5/single-page.html#timers, not the ECMA spec. The
ECMA spec has no concept of time-based delays at all, promise-based or
otherwise.

On Wed, Aug 16, 2017 at 11:03 PM, Naveen Chawla <naveen.c...@gmail.com>
wrote:

> 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 <kaizhu...@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 <matthewwr...@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" <valentin...@gmail.com>
>> wrote:
>> >
>> > @logan ah, oops, that was an (incorrect) assumption about the proposed
>> > behavior on my part
>> >
>> > _______________________________________________
>> > es-discuss mailing list
>> > es-discuss@mozilla.org
>> > https://mail.mozilla.org/listinfo/es-discuss
>> >
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss@mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to