Skip to content

Commit

Permalink
doc: add note about timeout delay > TIMEOUT_MAX
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
sitegui authored and rvagg committed Nov 6, 2015
1 parent 5977963 commit 7fd8f13
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions doc/api/timers.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ It is important to note that your callback will probably not be called in exactl
the callback will fire, nor of the ordering things will fire in. The callback will
be called as close as possible to the time specified.

To follow browser behavior, when using delays larger than 2147483647
milliseconds (approximately 25 days) or less than 1, the timeout is executed
immediately, as if the `delay` was set to 1.

## clearTimeout(timeoutObject)

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

To follow browser behavior, when using delays larger than 2147483647
milliseconds (approximately 25 days) or less than 1, Node.js will use 1 as the
`delay`.

## clearInterval(intervalObject)

Stops an interval from triggering.
Expand Down

0 comments on commit 7fd8f13

Please sign in to comment.