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: mark optional parameters in timers.md #35764

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions doc/api/timers.md
Expand Up @@ -190,14 +190,14 @@ async function timerExample() {
timerExample();
```

### `setInterval(callback, delay[, ...args])`
### `setInterval(callback[, delay[, ...args]])`
<!-- YAML
added: v0.0.1
-->

* `callback` {Function} The function to call when the timer elapses.
* `delay` {number} The number of milliseconds to wait before calling the
`callback`.
`callback`. **Default**: `1`.
* `...args` {any} Optional arguments to pass when the `callback` is called.
* Returns: {Timeout} for use with [`clearInterval()`][]

Expand All @@ -208,14 +208,14 @@ set to `1`. Non-integer delays are truncated to an integer.

If `callback` is not a function, a [`TypeError`][] will be thrown.

### `setTimeout(callback, delay[, ...args])`
### `setTimeout(callback[, delay[, ...args]])`
<!-- YAML
added: v0.0.1
-->

* `callback` {Function} The function to call when the timer elapses.
* `delay` {number} The number of milliseconds to wait before calling the
`callback`.
`callback`. **Default**: `1`.
* `...args` {any} Optional arguments to pass when the `callback` is called.
* Returns: {Timeout} for use with [`clearTimeout()`][]

Expand Down Expand Up @@ -332,10 +332,10 @@ that return `Promise` objects. The API is accessible via
const timersPromises = require('timers/promises');
```

### `timersPromises.setTimeout(delay\[, value\[, options\]\])`
### `timersPromises.setTimeout([delay[, value[, options]]])`

* `delay` {number} The number of milliseconds to wait before resolving the
`Promise`.
`Promise`. **Default**: `1`.
* `value` {any} A value with which the `Promise` is resolved.
* `options` {Object}
* `ref` {boolean} Set to `false` to indicate that the scheduled `Timeout`
Expand All @@ -344,7 +344,7 @@ const timersPromises = require('timers/promises');
* `signal` {AbortSignal} An optional `AbortSignal` that can be used to
cancel the scheduled `Timeout`.

### `timersPromises.setImmediate(\[value\[, options\]\])`
### `timersPromises.setImmediate([value[, options]])`

* `value` {any} A value with which the `Promise` is resolved.
* `options` {Object}
Expand Down