Skip to content

Scheduling: setTimeout and setInterval #3423

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

bogdanbacosca
Copy link
Contributor

lines 101, 211, 259, 261, 280, 282 and 284 - improvement suggestions
line 130 - grammar fix

@@ -127,7 +127,7 @@ setTimeout(() => { clearInterval(timerId); alert('stop'); }, 5000);
```

```smart header="Time goes on while `alert` is shown"
In most browsers, including Chrome and Firefox the internal timer continues "ticking" while showing `alert/confirm/prompt`.
In most browsers including Chrome and Firefox, the internal timer continues "ticking" while showing `alert/confirm/prompt`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO should have both:

In most browsers, including Chrome and Firefox, the internal timer continues "ticking" while showing alert/confirm/prompt.

@@ -208,7 +208,7 @@ Did you notice?

That's normal, because the time taken by `func`'s execution "consumes" a part of the interval.

It is possible that `func`'s execution turns out to be longer than we expected and takes more than 100ms.
It is possible that `func`'s execution to be longer than we expected and take more than 100ms.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

disagree, leave as original

@@ -256,9 +256,9 @@ The first line "puts the call into calendar after 0ms". But the scheduler will o
There are also advanced browser-related use cases of zero-delay timeout, that we'll discuss in the chapter <info:event-loop>.

````smart header="Zero delay is in fact not zero (in a browser)"
In the browser, there's a limitation of how often nested timers can run. The [HTML Living Standard](https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timers) says: "after five nested timers, the interval is forced to be at least 4 milliseconds.".
In the browser, there's a limitation for how often nested timers can run. The [HTML Living Standard](https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timers) says: "after five nested timers, the interval is forced to be at least 4 milliseconds.".
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

disagree

@javascript-translate-bot javascript-translate-bot added the changes requested Waiting for changes and /done from PR author label Aug 24, 2024
@javascript-translate-bot

Please make the requested changes. After it, add a comment "/done".
Then I'll ask for a new review 👻

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
changes requested Waiting for changes and /done from PR author
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants