From 7fd8f1371e75c99a88e354b60c76806cc81dc6cd Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Sat, 24 Oct 2015 23:56:49 -0200 Subject: [PATCH] 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 Reviewed-By: Rich Trott --- doc/api/timers.markdown | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/api/timers.markdown b/doc/api/timers.markdown index ed7da5076a791f..1dc456aaad925f 100644 --- a/doc/api/timers.markdown +++ b/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 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. @@ -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.