From 7248171e4cc95b340214c4e99007f25884a19eff Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Sat, 14 Apr 2018 14:38:02 +0300 Subject: [PATCH] doc: unify section structures PR-URL: https://github.com/nodejs/node/pull/20028 Reviewed-By: James M Snell Reviewed-By: Trivikram Kamat --- doc/api/perf_hooks.md | 108 ++++++++++++++++++-------------------- doc/api/string_decoder.md | 4 +- tools/doc/type-parser.js | 2 +- 3 files changed, 56 insertions(+), 58 deletions(-) diff --git a/doc/api/perf_hooks.md b/doc/api/perf_hooks.md index a3c3b2eb365efc..c6c16954f4f44b 100644 --- a/doc/api/perf_hooks.md +++ b/doc/api/perf_hooks.md @@ -340,12 +340,16 @@ The high resolution millisecond timestamp at which the V8 platform was initialized. -## Class: PerformanceObserver(callback) +## Class: PerformanceObserver + +### new PerformanceObserver(callback) -* `callback` {Function} A `PerformanceObserverCallback` callback function. +* `callback` {Function} + * `list` {PerformanceObserverEntryList} + * `observer` {PerformanceObserver} `PerformanceObserver` objects provide notifications when new `PerformanceEntry` instances have been added to the Performance Timeline. @@ -364,69 +368,16 @@ obs.observe({ entryTypes: ['mark'], buffered: true }); performance.mark('test'); ``` - Because `PerformanceObserver` instances introduce their own additional performance overhead, instances should not be left subscribed to notifications indefinitely. Users should disconnect observers as soon as they are no longer needed. -### Callback: PerformanceObserverCallback(list, observer) - - -* `list` {PerformanceObserverEntryList} -* `observer` {PerformanceObserver} - -The `PerformanceObserverCallback` is invoked when a `PerformanceObserver` is +The `callback` is invoked when a `PerformanceObserver` is notified about new `PerformanceEntry` instances. The callback receives a `PerformanceObserverEntryList` instance and a reference to the `PerformanceObserver`. -### Class: PerformanceObserverEntryList - - -The `PerformanceObserverEntryList` class is used to provide access to the -`PerformanceEntry` instances passed to a `PerformanceObserver`. - -#### performanceObserverEntryList.getEntries() - - -* Returns: {PerformanceEntry[]} - -Returns a list of `PerformanceEntry` objects in chronological order -with respect to `performanceEntry.startTime`. - -#### performanceObserverEntryList.getEntriesByName(name[, type]) - - -* `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) - - -* `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() + +The `PerformanceObserverEntryList` class is used to provide access to the +`PerformanceEntry` instances passed to a `PerformanceObserver`. + +### performanceObserverEntryList.getEntries() + + +* Returns: {PerformanceEntry[]} + +Returns a list of `PerformanceEntry` objects in chronological order +with respect to `performanceEntry.startTime`. + +### performanceObserverEntryList.getEntriesByName(name[, type]) + + +* `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) + + +* `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 ### Measuring the duration of async operations diff --git a/doc/api/string_decoder.md b/doc/api/string_decoder.md index 5a8a5721b2c11f..1311f372551c9c 100644 --- a/doc/api/string_decoder.md +++ b/doc/api/string_decoder.md @@ -42,7 +42,9 @@ decoder.write(Buffer.from([0x82])); console.log(decoder.end(Buffer.from([0xAC]))); ``` -## Class: new StringDecoder([encoding]) +## Class: StringDecoder + +### new StringDecoder([encoding]) diff --git a/tools/doc/type-parser.js b/tools/doc/type-parser.js index d95fcf2e23db1f..134df2b4419ae6 100644 --- a/tools/doc/type-parser.js +++ b/tools/doc/type-parser.js @@ -92,7 +92,7 @@ const customTypesMap = { 'PerformanceNodeTiming': 'perf_hooks.html#perf_hooks_class_performancenodetiming_extends_performanceentry', // eslint-disable-line max-len 'PerformanceObserver': - 'perf_hooks.html#perf_hooks_class_performanceobserver_callback', + 'perf_hooks.html#perf_hooks_class_performanceobserver', 'PerformanceObserverEntryList': 'perf_hooks.html#perf_hooks_class_performanceobserverentrylist',