-
Notifications
You must be signed in to change notification settings - Fork 22.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update setTimeout() and setInterval() Return Value Description with Numeric Range and Clarification #39006
Conversation
Preview URLs
(comment last updated: 2025-04-08 01:09:23) |
I think similar changes can also be included on the |
Feel free to |
I revised the overview paragraph for the |
Description
This pull request updates the description of the return value for
setTimeout()
andseInterval()
to clarify exactly what the returned timeout/interval identifier is—as well as to include its typical numeric range.Numeric Range: Added a parenthesized note to indicate the typical numeric range of the timeout ID/ interval ID, providing developers with an expectation of its value.
Clarification of the Timeout/ Interval Identifier: Defined the terms "timeoutId"/"intervalId" clearly as the unique identifier returned by setTimeout()/setInterval().
ID Pool Clarification: Revised the language regarding the reuse of IDs by replacing “different objects” with “distinct global environments” and clarifying that each global environment (e.g., windows, iframes, workers) maintains its own separate pool of timer IDs.
Motivation
Including the numeric range information improves clarity on what developers can expect in terms of the possible values.
Explicitly defining the timeout identifier and clarifying the ID pool explanation helps prevent confusion about when and where these identifiers might be reused.
Additional details
Related issues and pull requests
Fixes #39004