From 715d7f31b384723b1fc4691cfd54a3e6a1a56bb8 Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Sat, 14 Apr 2018 14:38:02 +0300 Subject: 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 ++++++++++++++++++++++++-------------------------- 1 file changed, 52 insertions(+), 56 deletions(-) (limited to 'doc/api/perf_hooks.md') diff --git a/doc/api/perf_hooks.md b/doc/api/perf_hooks.md index a3c3b2eb36..c6c16954f4 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 -- cgit v1.2.3