Skip to content

Commit 7fd8f13

Browse files
Guilherme Souzarvagg
Guilherme Souza
authored andcommitted
doc: add note about timeout delay > TIMEOUT_MAX
When setTimeout() and setInterval() are called with `delay` greater than TIMEOUT_MAX (2147483647), the supplied value is ignored and 1 is used instead. Add a note about this in the timers docs. PR-URL: #3512 Reviewed-By: Trevor Norris <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 5977963 commit 7fd8f13

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

doc/api/timers.markdown

+8
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ It is important to note that your callback will probably not be called in exactl
1616
the callback will fire, nor of the ordering things will fire in. The callback will
1717
be called as close as possible to the time specified.
1818

19+
To follow browser behavior, when using delays larger than 2147483647
20+
milliseconds (approximately 25 days) or less than 1, the timeout is executed
21+
immediately, as if the `delay` was set to 1.
22+
1923
## clearTimeout(timeoutObject)
2024

2125
Prevents a timeout from triggering.
@@ -26,6 +30,10 @@ To schedule the repeated execution of `callback` every `delay` milliseconds.
2630
Returns a `intervalObject` for possible use with `clearInterval()`. Optionally
2731
you can also pass arguments to the callback.
2832

33+
To follow browser behavior, when using delays larger than 2147483647
34+
milliseconds (approximately 25 days) or less than 1, Node.js will use 1 as the
35+
`delay`.
36+
2937
## clearInterval(intervalObject)
3038

3139
Stops an interval from triggering.

0 commit comments

Comments
 (0)