doc: unify section structures
PR-URL: https://github.com/nodejs/node/pull/20028 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
parent
887f4c54ce
commit
715d7f31b3
@ -340,12 +340,16 @@ The high resolution millisecond timestamp at which the V8 platform was
|
|||||||
initialized.
|
initialized.
|
||||||
|
|
||||||
|
|
||||||
## Class: PerformanceObserver(callback)
|
## Class: PerformanceObserver
|
||||||
|
|
||||||
|
### new PerformanceObserver(callback)
|
||||||
<!-- YAML
|
<!-- YAML
|
||||||
added: v8.5.0
|
added: v8.5.0
|
||||||
-->
|
-->
|
||||||
|
|
||||||
* `callback` {Function} A `PerformanceObserverCallback` callback function.
|
* `callback` {Function}
|
||||||
|
* `list` {PerformanceObserverEntryList}
|
||||||
|
* `observer` {PerformanceObserver}
|
||||||
|
|
||||||
`PerformanceObserver` objects provide notifications when new
|
`PerformanceObserver` objects provide notifications when new
|
||||||
`PerformanceEntry` instances have been added to the Performance Timeline.
|
`PerformanceEntry` instances have been added to the Performance Timeline.
|
||||||
@ -364,69 +368,16 @@ obs.observe({ entryTypes: ['mark'], buffered: true });
|
|||||||
|
|
||||||
performance.mark('test');
|
performance.mark('test');
|
||||||
```
|
```
|
||||||
|
|
||||||
Because `PerformanceObserver` instances introduce their own additional
|
Because `PerformanceObserver` instances introduce their own additional
|
||||||
performance overhead, instances should not be left subscribed to notifications
|
performance overhead, instances should not be left subscribed to notifications
|
||||||
indefinitely. Users should disconnect observers as soon as they are no
|
indefinitely. Users should disconnect observers as soon as they are no
|
||||||
longer needed.
|
longer needed.
|
||||||
|
|
||||||
### Callback: PerformanceObserverCallback(list, observer)
|
The `callback` is invoked when a `PerformanceObserver` is
|
||||||
<!-- YAML
|
|
||||||
added: v8.5.0
|
|
||||||
-->
|
|
||||||
|
|
||||||
* `list` {PerformanceObserverEntryList}
|
|
||||||
* `observer` {PerformanceObserver}
|
|
||||||
|
|
||||||
The `PerformanceObserverCallback` is invoked when a `PerformanceObserver` is
|
|
||||||
notified about new `PerformanceEntry` instances. The callback receives a
|
notified about new `PerformanceEntry` instances. The callback receives a
|
||||||
`PerformanceObserverEntryList` instance and a reference to the
|
`PerformanceObserverEntryList` instance and a reference to the
|
||||||
`PerformanceObserver`.
|
`PerformanceObserver`.
|
||||||
|
|
||||||
### Class: PerformanceObserverEntryList
|
|
||||||
<!-- YAML
|
|
||||||
added: v8.5.0
|
|
||||||
-->
|
|
||||||
|
|
||||||
The `PerformanceObserverEntryList` class is used to provide access to the
|
|
||||||
`PerformanceEntry` instances passed to a `PerformanceObserver`.
|
|
||||||
|
|
||||||
#### performanceObserverEntryList.getEntries()
|
|
||||||
<!-- YAML
|
|
||||||
added: v8.5.0
|
|
||||||
-->
|
|
||||||
|
|
||||||
* Returns: {PerformanceEntry[]}
|
|
||||||
|
|
||||||
Returns a list of `PerformanceEntry` objects in chronological order
|
|
||||||
with respect to `performanceEntry.startTime`.
|
|
||||||
|
|
||||||
#### performanceObserverEntryList.getEntriesByName(name[, type])
|
|
||||||
<!-- YAML
|
|
||||||
added: v8.5.0
|
|
||||||
-->
|
|
||||||
|
|
||||||
* `name` {string}
|
|
||||||
* `type` {string}
|
|
||||||
* Returns: {PerformanceEntry[]}
|
|
||||||
|
|
||||||
Returns a list of `PerformanceEntry` objects in chronological order
|
|
||||||
with respect to `performanceEntry.startTime` whose `performanceEntry.name` is
|
|
||||||
equal to `name`, and optionally, whose `performanceEntry.entryType` is equal to
|
|
||||||
`type`.
|
|
||||||
|
|
||||||
#### performanceObserverEntryList.getEntriesByType(type)
|
|
||||||
<!-- YAML
|
|
||||||
added: v8.5.0
|
|
||||||
-->
|
|
||||||
|
|
||||||
* `type` {string}
|
|
||||||
* Returns: {PerformanceEntry[]}
|
|
||||||
|
|
||||||
Returns a list of `PerformanceEntry` objects in chronological order
|
|
||||||
with respect to `performanceEntry.startTime` whose `performanceEntry.entryType`
|
|
||||||
is equal to `type`.
|
|
||||||
|
|
||||||
### performanceObserver.disconnect()
|
### performanceObserver.disconnect()
|
||||||
<!-- YAML
|
<!-- YAML
|
||||||
added: v8.5.0
|
added: v8.5.0
|
||||||
@ -482,6 +433,51 @@ for (let n = 0; n < 3; n++)
|
|||||||
performance.mark(`test${n}`);
|
performance.mark(`test${n}`);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Class: PerformanceObserverEntryList
|
||||||
|
<!-- YAML
|
||||||
|
added: v8.5.0
|
||||||
|
-->
|
||||||
|
|
||||||
|
The `PerformanceObserverEntryList` class is used to provide access to the
|
||||||
|
`PerformanceEntry` instances passed to a `PerformanceObserver`.
|
||||||
|
|
||||||
|
### performanceObserverEntryList.getEntries()
|
||||||
|
<!-- YAML
|
||||||
|
added: v8.5.0
|
||||||
|
-->
|
||||||
|
|
||||||
|
* Returns: {PerformanceEntry[]}
|
||||||
|
|
||||||
|
Returns a list of `PerformanceEntry` objects in chronological order
|
||||||
|
with respect to `performanceEntry.startTime`.
|
||||||
|
|
||||||
|
### performanceObserverEntryList.getEntriesByName(name[, type])
|
||||||
|
<!-- YAML
|
||||||
|
added: v8.5.0
|
||||||
|
-->
|
||||||
|
|
||||||
|
* `name` {string}
|
||||||
|
* `type` {string}
|
||||||
|
* Returns: {PerformanceEntry[]}
|
||||||
|
|
||||||
|
Returns a list of `PerformanceEntry` objects in chronological order
|
||||||
|
with respect to `performanceEntry.startTime` whose `performanceEntry.name` is
|
||||||
|
equal to `name`, and optionally, whose `performanceEntry.entryType` is equal to
|
||||||
|
`type`.
|
||||||
|
|
||||||
|
### performanceObserverEntryList.getEntriesByType(type)
|
||||||
|
<!-- YAML
|
||||||
|
added: v8.5.0
|
||||||
|
-->
|
||||||
|
|
||||||
|
* `type` {string}
|
||||||
|
* Returns: {PerformanceEntry[]}
|
||||||
|
|
||||||
|
Returns a list of `PerformanceEntry` objects in chronological order
|
||||||
|
with respect to `performanceEntry.startTime` whose `performanceEntry.entryType`
|
||||||
|
is equal to `type`.
|
||||||
|
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
### Measuring the duration of async operations
|
### Measuring the duration of async operations
|
||||||
|
@ -42,7 +42,9 @@ decoder.write(Buffer.from([0x82]));
|
|||||||
console.log(decoder.end(Buffer.from([0xAC])));
|
console.log(decoder.end(Buffer.from([0xAC])));
|
||||||
```
|
```
|
||||||
|
|
||||||
## Class: new StringDecoder([encoding])
|
## Class: StringDecoder
|
||||||
|
|
||||||
|
### new StringDecoder([encoding])
|
||||||
<!-- YAML
|
<!-- YAML
|
||||||
added: v0.1.99
|
added: v0.1.99
|
||||||
-->
|
-->
|
||||||
|
@ -92,7 +92,7 @@ const customTypesMap = {
|
|||||||
'PerformanceNodeTiming':
|
'PerformanceNodeTiming':
|
||||||
'perf_hooks.html#perf_hooks_class_performancenodetiming_extends_performanceentry', // eslint-disable-line max-len
|
'perf_hooks.html#perf_hooks_class_performancenodetiming_extends_performanceentry', // eslint-disable-line max-len
|
||||||
'PerformanceObserver':
|
'PerformanceObserver':
|
||||||
'perf_hooks.html#perf_hooks_class_performanceobserver_callback',
|
'perf_hooks.html#perf_hooks_class_performanceobserver',
|
||||||
'PerformanceObserverEntryList':
|
'PerformanceObserverEntryList':
|
||||||
'perf_hooks.html#perf_hooks_class_performanceobserverentrylist',
|
'perf_hooks.html#perf_hooks_class_performanceobserverentrylist',
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user