Skip to content
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

doc: add missing parameter types #39013

Closed
wants to merge 2 commits into from

Conversation

VoltrexKeyva
Copy link
Member

@VoltrexKeyva VoltrexKeyva commented Jun 12, 2021

Both of the clearTimeout() and clearInterval() functions in the timers lib accepts the primitive of the Timeout object returned by the functions in a number or string type, e.g.

const t = setTimeout(console.log, 5000, 'test');

clearTimeout(t[Symbol.toPrimitive]());

Both of the `clearTimeout()` and `clearInterval()` functions in the `timers` lib accepts the ID of the `Timeout` object returned by the functions in a number or string type, e.g.
```js
const t = setTimeout(console.log, 5000, 'test');

clearTimeout(t[Symbol.toPrimitive]());
```
@github-actions github-actions bot added doc Issues and PRs related to the documentations. timers Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout. labels Jun 12, 2021
Copy link
Member

@Trott Trott left a comment

Choose a reason for hiding this comment

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

Generally looks good to me. OK with it as is if people want to land it, but left a few comments suggesting some modifications I'd prefer to see.

doc/api/timers.md Outdated Show resolved Hide resolved
doc/api/timers.md Outdated Show resolved Hide resolved
@Trott
Copy link
Member

Trott commented Jun 12, 2021

@nodejs/timers

Copy link
Member

@lpinca lpinca left a comment

Choose a reason for hiding this comment

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

LGTM with @Trott's comments addressed.

Change "ID" to "primitive" and reference `timeout[Symbol.toPrimitive]()` with a hyperlink.
Copy link
Member

@benjamingr benjamingr left a comment

Choose a reason for hiding this comment

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

I don't understand this change - when is the return value not a timeout?

@VoltrexKeyva
Copy link
Member Author

I don't understand this change - when is the return value not a timeout?

This change is not related to the return value, it is related to the parameter type of clearTimeout() and clearInterval() which also accepts the primitive of a Timeout object rather than just the Timeout object itself.

Copy link
Member

@benjamingr benjamingr left a comment

Choose a reason for hiding this comment

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

LGTM

@RaisinTen RaisinTen added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jun 13, 2021
@jasnell
Copy link
Member

jasnell commented Jun 14, 2021

Landed in 68229a9

@jasnell jasnell closed this Jun 14, 2021
jasnell pushed a commit that referenced this pull request Jun 14, 2021
Both of the `clearTimeout()` and `clearInterval()` functions in the
`timers` lib accepts the ID of the `Timeout` object returned by the
functions in a number or string type, e.g.

```js
const t = setTimeout(console.log, 5000, 'test');

clearTimeout(t[Symbol.toPrimitive]());
```

PR-URL: #39013
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@VoltrexKeyva VoltrexKeyva deleted the patch-8 branch June 14, 2021 15:49
danielleadams pushed a commit that referenced this pull request Jun 15, 2021
Both of the `clearTimeout()` and `clearInterval()` functions in the
`timers` lib accepts the ID of the `Timeout` object returned by the
functions in a number or string type, e.g.

```js
const t = setTimeout(console.log, 5000, 'test');

clearTimeout(t[Symbol.toPrimitive]());
```

PR-URL: #39013
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@danielleadams danielleadams mentioned this pull request Jun 15, 2021
danielleadams pushed a commit that referenced this pull request Jun 17, 2021
Both of the `clearTimeout()` and `clearInterval()` functions in the
`timers` lib accepts the ID of the `Timeout` object returned by the
functions in a number or string type, e.g.

```js
const t = setTimeout(console.log, 5000, 'test');

clearTimeout(t[Symbol.toPrimitive]());
```

PR-URL: #39013
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
richardlau pushed a commit that referenced this pull request Jul 19, 2021
Both of the `clearTimeout()` and `clearInterval()` functions in the
`timers` lib accepts the ID of the `Timeout` object returned by the
functions in a number or string type, e.g.

```js
const t = setTimeout(console.log, 5000, 'test');

clearTimeout(t[Symbol.toPrimitive]());
```

PR-URL: #39013
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
richardlau pushed a commit that referenced this pull request Jul 20, 2021
Both of the `clearTimeout()` and `clearInterval()` functions in the
`timers` lib accepts the ID of the `Timeout` object returned by the
functions in a number or string type, e.g.

```js
const t = setTimeout(console.log, 5000, 'test');

clearTimeout(t[Symbol.toPrimitive]());
```

PR-URL: #39013
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@richardlau richardlau mentioned this pull request Jul 20, 2021
foxxyz pushed a commit to foxxyz/node that referenced this pull request Oct 18, 2021
Both of the `clearTimeout()` and `clearInterval()` functions in the
`timers` lib accepts the ID of the `Timeout` object returned by the
functions in a number or string type, e.g.

```js
const t = setTimeout(console.log, 5000, 'test');

clearTimeout(t[Symbol.toPrimitive]());
```

PR-URL: nodejs#39013
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. doc Issues and PRs related to the documentations. timers Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants