This commit is contained in:
Ilya Kantor 2019-07-31 11:22:02 +03:00
parent ff09b8c496
commit 6782931a9e
2 changed files with 19 additions and 19 deletions

View file

@ -241,7 +241,7 @@ There's a special use case: `setTimeout(func, 0)`, or just `setTimeout(func)`.
This schedules the execution of `func` as soon as possible. But scheduler will invoke it only after the current code is complete.
So the function is scheduled to run "right after" the current code. In other words, *asynchronously*.
So the function is scheduled to run "right after" the current code.
For instance, this outputs "Hello", then immediately "World":
@ -292,7 +292,7 @@ For server-side JavaScript, that limitation does not exist, and there exist othe
- Zero delay scheduling with `setTimeout(func, 0)` (the same as `setTimeout(func)`) is used to schedule the call "as soon as possible, but after the current code is complete".
- The browser limits the minimal delay for five or more nested call of `setTimeout` or for `setInterval` (after 5th call) to 4ms. That's for historical reasons.
Please note that all scheduling methods do not *guarantee* the exact delay.
Please note that all scheduling methods do not *guarantee* the exact delay.
For example, the in-browser timer may slow down for a lot of reasons:
- The CPU is overloaded.