Browse Source

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: https://github.com/nodejs/node/pull/3512
Reviewed-By: Trevor Norris <trev.norris@gmai.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
v4.x
Guilherme Souza 9 years ago
committed by James M Snell
parent
commit
f823c2e742
  1. 8
      doc/api/timers.markdown

8
doc/api/timers.markdown

@ -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 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. 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) ## clearTimeout(timeoutObject)
Prevents a timeout from triggering. Prevents a timeout from triggering.
@ -26,6 +30,10 @@ To schedule the repeated execution of `callback` every `delay` milliseconds.
Returns a `intervalObject` for possible use with `clearInterval()`. Optionally Returns a `intervalObject` for possible use with `clearInterval()`. Optionally
you can also pass arguments to the callback. 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) ## clearInterval(intervalObject)
Stops an interval from triggering. Stops an interval from triggering.

Loading…
Cancel
Save