Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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. This adds a note about this in the timers docs.
  • Loading branch information
sitegui committed Oct 25, 2015
commit f135a8972ab134796536d9b59c32246b26e5d066
4 changes: 4 additions & 0 deletions doc/api/timers.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ 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), the timeout is executed immediately, as if the `delay` was set to 1.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe say "If delay is less than one, or greater than the maximum allowed value of 2147483647, it will be assigned a value of 1."


## clearTimeout(timeoutObject)

Prevents a timeout from triggering.
Expand All @@ -26,6 +28,8 @@ 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), Node.js will use 1 as the `delay`.

## clearInterval(intervalObject)

Stops an interval from triggering.
Expand Down