From dfb8c72c3e775b4a763ad5c495756e2897a46847 Mon Sep 17 00:00:00 2001 From: skyclouds2001 Date: Mon, 29 Apr 2024 17:37:28 +0800 Subject: [PATCH 1/7] move --- files/en-us/_redirects.txt | 9 ++--- files/en-us/_wikihistory.json | 40 +++++++++---------- files/en-us/web/api/performance/index.md | 2 +- files/en-us/web/api/performance_api/index.md | 4 +- .../performance_api/performance_data/index.md | 2 +- files/en-us/web/api/window/index.md | 2 +- .../performance}/index.md | 16 +++++--- .../en-us/web/api/workerglobalscope/index.md | 2 +- .../workerglobalscope/performance/index.md | 33 +++++++++++++++ .../global_objects/date/gettime/index.md | 2 +- .../reference/global_objects/date/index.md | 2 +- files/jsondata/GroupData.json | 2 +- package.json | 3 +- 13 files changed, 78 insertions(+), 41 deletions(-) rename files/en-us/web/api/{performance_property => window/performance}/index.md (85%) create mode 100644 files/en-us/web/api/workerglobalscope/performance/index.md diff --git a/files/en-us/_redirects.txt b/files/en-us/_redirects.txt index e76c0266834d555..4e7bfc3da2cb101 100644 --- a/files/en-us/_redirects.txt +++ b/files/en-us/_redirects.txt @@ -2196,7 +2196,7 @@ /en-US/docs/DOM/window.outerHeight /en-US/docs/Web/API/Window/outerHeight /en-US/docs/DOM/window.outerWidth /en-US/docs/Web/API/Window/outerWidth /en-US/docs/DOM/window.parent /en-US/docs/Web/API/Window/parent -/en-US/docs/DOM/window.performance /en-US/docs/Web/API/performance_property +/en-US/docs/DOM/window.performance /en-US/docs/Web/API/Window/performance /en-US/docs/DOM/window.performance.now /en-US/docs/Web/API/Performance/now /en-US/docs/DOM/window.personalbar /en-US/docs/Web/API/Window/personalbar /en-US/docs/DOM/window.postMessage /en-US/docs/Web/API/Window/postMessage @@ -10210,7 +10210,6 @@ /en-US/docs/Web/API/Window/openDialog /en-US/docs/Web/API/Window /en-US/docs/Web/API/Window/pageXOffset /en-US/docs/Web/API/Window/scrollX /en-US/docs/Web/API/Window/pageYOffset /en-US/docs/Web/API/Window/scrollY -/en-US/docs/Web/API/Window/performance /en-US/docs/Web/API/performance_property /en-US/docs/Web/API/Window/removeEventListener /en-US/docs/Web/API/EventTarget/removeEventListener /en-US/docs/Web/API/Window/resolveLocalFileSystemURL /en-US/docs/Web/API/File_and_Directory_Entries_API#resolvelocalfilesystemurl() /en-US/docs/Web/API/Window/restore /en-US/docs/Web/API/Window/moveTo @@ -10303,7 +10302,7 @@ /en-US/docs/Web/API/WorkerGlobalScope.onlanguagechange /en-US/docs/Web/API/WorkerGlobalScope/languagechange_event /en-US/docs/Web/API/WorkerGlobalScope.onoffline /en-US/docs/Web/API/WorkerGlobalScope/offline_event /en-US/docs/Web/API/WorkerGlobalScope.ononline /en-US/docs/Web/API/WorkerGlobalScope/online_event -/en-US/docs/Web/API/WorkerGlobalScope.performance /en-US/docs/Web/API/performance_property +/en-US/docs/Web/API/WorkerGlobalScope.performance /en-US/docs/Web/API/WorkerGlobalScope/performance /en-US/docs/Web/API/WorkerGlobalScope.self /en-US/docs/Web/API/WorkerGlobalScope/self /en-US/docs/Web/API/WorkerGlobalScope/WorkerGlobalScope.caches /en-US/docs/Web/API/caches /en-US/docs/Web/API/WorkerGlobalScope/atob /en-US/docs/Web/API/atob @@ -10319,7 +10318,6 @@ /en-US/docs/Web/API/WorkerGlobalScope/onlanguagechange /en-US/docs/Web/API/WorkerGlobalScope/languagechange_event /en-US/docs/Web/API/WorkerGlobalScope/onoffline /en-US/docs/Web/API/WorkerGlobalScope/offline_event /en-US/docs/Web/API/WorkerGlobalScope/ononline /en-US/docs/Web/API/WorkerGlobalScope/online_event -/en-US/docs/Web/API/WorkerGlobalScope/performance /en-US/docs/Web/API/performance_property /en-US/docs/Web/API/WorkerGlobalScope/requestFileSystemSync /en-US/docs/Web/API/File_and_Directory_Entries_API /en-US/docs/Web/API/WorkerGlobalScope/setInterval /en-US/docs/Web/API/setInterval /en-US/docs/Web/API/WorkerGlobalScope/setTimeout /en-US/docs/Web/API/setTimeout @@ -10706,6 +10704,7 @@ /en-US/docs/Web/API/notification_1/vibrate /en-US/docs/Web/API/Notification/vibrate /en-US/docs/Web/API/onMSVideoOptimalLayoutChanged /en-US/docs/Web/API/HTMLVideoElement /en-US/docs/Web/API/onMSVideoOptimalLayoutChanged_ /en-US/docs/Web/API/HTMLVideoElement +/en-US/docs/Web/API/performance_property /en-US/docs/Web/API/Window/performance /en-US/docs/Web/API/range.cloneContents /en-US/docs/Web/API/range/cloneContents /en-US/docs/Web/API/range.cloneRange /en-US/docs/Web/API/range/cloneRange /en-US/docs/Web/API/range.collapse /en-US/docs/Web/API/range/collapse @@ -10887,7 +10886,7 @@ /en-US/docs/Web/API/window.outerHeight /en-US/docs/Web/API/Window/outerHeight /en-US/docs/Web/API/window.outerWidth /en-US/docs/Web/API/Window/outerWidth /en-US/docs/Web/API/window.parent /en-US/docs/Web/API/Window/parent -/en-US/docs/Web/API/window.performance /en-US/docs/Web/API/performance_property +/en-US/docs/Web/API/window.performance /en-US/docs/Web/API/Window/performance /en-US/docs/Web/API/window.performance.now /en-US/docs/Web/API/Performance/now /en-US/docs/Web/API/window.personalbar /en-US/docs/Web/API/Window/personalbar /en-US/docs/Web/API/window.postMessage /en-US/docs/Web/API/Window/postMessage diff --git a/files/en-us/_wikihistory.json b/files/en-us/_wikihistory.json index 1dd1489c6eae9ed..e94ce32f52556a6 100644 --- a/files/en-us/_wikihistory.json +++ b/files/en-us/_wikihistory.json @@ -67949,6 +67949,26 @@ "modified": "2020-10-15T22:16:14.230Z", "contributors": ["mfuji09", "wbamberg"] }, + "Web/API/Window/performance": { + "modified": "2020-10-15T21:22:10.802Z", + "contributors": [ + "sideshowbarker", + "connorshea", + "Sheppy", + "anonyco", + "kmag", + "sarafec", + "smarts", + "jsantell", + "fscholz", + "paul.irish", + "teoli", + "julienw", + "iamanupmenon", + "ethertank", + "MattBrubeck" + ] + }, "Web/API/Window/personalbar": { "modified": "2020-10-15T21:14:01.101Z", "contributors": [ @@ -71578,26 +71598,6 @@ "ziyunfei" ] }, - "Web/API/performance_property": { - "modified": "2020-10-15T21:22:10.802Z", - "contributors": [ - "sideshowbarker", - "connorshea", - "Sheppy", - "anonyco", - "kmag", - "sarafec", - "smarts", - "jsantell", - "fscholz", - "paul.irish", - "teoli", - "julienw", - "iamanupmenon", - "ethertank", - "MattBrubeck" - ] - }, "Web/API/queueMicrotask": { "modified": "2020-10-15T22:21:06.789Z", "contributors": [ diff --git a/files/en-us/web/api/performance/index.md b/files/en-us/web/api/performance/index.md index 8c1780d1a5f2533..fd4de6659bfe4f0 100644 --- a/files/en-us/web/api/performance/index.md +++ b/files/en-us/web/api/performance/index.md @@ -9,7 +9,7 @@ browser-compat: api.Performance The **`Performance`** interface provides access to performance-related information for the current page. -An object of this type can be obtained by calling `window.performance` or `self.performance` in workers. Note that Performance entries are per context. If you create a mark on the main thread (or other worker), you cannot see it in a worker thread, and vice versa. See [`self.performance`](/en-US/docs/Web/API/performance_property) for which APIs are available in window and worker contexts. +An object of this type can be obtained by calling `window.performance` or `self.performance` in workers. Note that Performance entries are per context. If you create a mark on the main thread (or other worker), you cannot see it in a worker thread, and vice versa. See {{domxref("window.performance")}} for which APIs are available in window and worker contexts. {{InheritanceDiagram}} diff --git a/files/en-us/web/api/performance_api/index.md b/files/en-us/web/api/performance_api/index.md index 7f3b8d786de984c..902151456caa3f1 100644 --- a/files/en-us/web/api/performance_api/index.md +++ b/files/en-us/web/api/performance_api/index.md @@ -29,7 +29,7 @@ Each performance metric is represented by a single {{domxref("PerformanceEntry") Most of the performance entries are recorded for you without you having to do anything, and are then accessible either through {{domxref("Performance.getEntries()")}} or (preferably) through {{domxref("PerformanceObserver")}}. For example, {{domxref("PerformanceEventTiming")}} entries are recorded for events that take longer than a set threshold. But the Performance API also enables you to define and record your own custom events, using the {{domxref("PerformanceMark")}} and {{domxref("PerformanceMeasure")}} interfaces. -The main {{domxref("Performance")}} interface is available for each global using {{domxref("performance_property", "self.performance")}} and enables you to add custom performance entries, to clear performance entries, and to retrieve performance entries. +The main {{domxref("Performance")}} interface is available for each global using {{domxref("Window.performance")}} or {{domxref("WorkerGlobalScope.performance")}} and enables you to add custom performance entries, to clear performance entries, and to retrieve performance entries. The {{domxref("PerformanceObserver")}} interface enables you to listen for various types of performance entry as they are recorded. @@ -50,7 +50,7 @@ The following interfaces are present in the Performance API: - {{domxref("LayoutShiftAttribution")}} - : Provides debugging information about elements which have shifted. - {{domxref("Performance")}} - - : Main interface to access performance measurements. Available to window and worker contexts using {{domxref("performance_property", "self.performance")}}. + - : Main interface to access performance measurements. Available to window and worker contexts using {{domxref("Window.performance")}} or {{domxref("WorkerGlobalScope.performance")}}. - {{domxref("PerformanceElementTiming")}} - : Measures rendering timestamps of specific elements. - {{domxref("PerformanceEntry")}} diff --git a/files/en-us/web/api/performance_api/performance_data/index.md b/files/en-us/web/api/performance_api/performance_data/index.md index f8a6f50ddb36e2a..ec11d66f845c97f 100644 --- a/files/en-us/web/api/performance_api/performance_data/index.md +++ b/files/en-us/web/api/performance_api/performance_data/index.md @@ -22,7 +22,7 @@ For some metrics you do have to tell the browser what to measure: ## Performance data structure -The Performance API collects performance data for each global object (`window.performance` or `self.performance` in workers). See [`self.performance`](/en-US/docs/Web/API/performance_property) for which APIs are available in window and worker contexts. If you are collecting performance metrics for multiple contexts, also take a look at [`performance.timeOrigin`](/en-US/docs/Web/API/Performance/timeOrigin) to synchronize time origins between contexts. +The Performance API collects performance data for each global object (`window.performance` or `self.performance` in workers). See {{domxref("window.performance")}} for which APIs are available in window and worker contexts. If you are collecting performance metrics for multiple contexts, also take a look at {{domxref("performance.timeOrigin")}} to synchronize time origins between contexts. Within these contexts, individual performance data is represented by performance entries. diff --git a/files/en-us/web/api/window/index.md b/files/en-us/web/api/window/index.md index 3107c90a671faab..461b8d1a2461722 100644 --- a/files/en-us/web/api/window/index.md +++ b/files/en-us/web/api/window/index.md @@ -105,7 +105,7 @@ Note that properties which are objects (e.g., for overriding the prototype of bu - : An alias for {{domxref("window.scrollY")}}. - {{domxref("Window.parent")}} {{ReadOnlyInline}} - : Returns a reference to the parent of the current window or subframe. -- {{domxref("performance_property", "Window.performance")}} {{ReadOnlyInline}} +- {{domxref("Window.performance")}} {{ReadOnlyInline}} - : Returns a {{domxref("Performance")}} object, which includes the {{domxref("Performance.timing", "timing")}} and {{domxref("Performance.navigation", "navigation")}} attributes, each of which is an object providing [performance-related](/en-US/docs/Web/API/Performance_API/Navigation_timing) data. See also [Using Navigation Timing](/en-US/docs/Web/API/Performance_API/Navigation_timing) for additional information and examples. - {{domxref("Window.personalbar")}} {{ReadOnlyInline}} - : Returns the personalbar object. diff --git a/files/en-us/web/api/performance_property/index.md b/files/en-us/web/api/window/performance/index.md similarity index 85% rename from files/en-us/web/api/performance_property/index.md rename to files/en-us/web/api/window/performance/index.md index 0687011d3542374..164f19c805b5410 100644 --- a/files/en-us/web/api/performance_property/index.md +++ b/files/en-us/web/api/window/performance/index.md @@ -1,20 +1,20 @@ --- -title: performance global property +title: "Window: performance property" short-title: performance -slug: Web/API/performance_property -page-type: web-api-global-property +slug: Web/API/Window/performance +page-type: web-api-instance-property browser-compat: api.performance --- -{{APIRef("Performance API")}}{{AvailableInWorkers}} +{{APIRef("Performance API")}} -The global **`performance`** property returns a {{domxref("Performance")}} object, which can be used to gather performance information about the context it is called in (window or worker). +The **`performance`** property of the {{domxref("Window")}} interface returns a {{domxref("Performance")}} object, which can be used to gather performance information about the context it is called in window. Performance entries are per context. If you create a mark on the main thread (or other worker), you cannot see it in a worker thread, and vice versa. ## Value -A {{domxref("Performance")}} object offering access to performance and timing-related information for the context it is called on (window or worker). +A {{domxref("Performance")}} object offering access to performance and timing-related information for the context it is called on window. ## Performance API availability @@ -50,3 +50,7 @@ The following table provides an overview about the availability of the performan ## Browser compatibility {{Compat}} + +## See also + +- {{domxref("WorkerGlobalScope.performance")}} diff --git a/files/en-us/web/api/workerglobalscope/index.md b/files/en-us/web/api/workerglobalscope/index.md index 76ade939d03e1e8..fb59fce866b4a38 100644 --- a/files/en-us/web/api/workerglobalscope/index.md +++ b/files/en-us/web/api/workerglobalscope/index.md @@ -37,7 +37,7 @@ _This interface inherits properties from the {{domxref("EventTarget")}} interfac - : Returns the {{domxref("WorkerNavigator")}} associated with the worker. It is a specific navigator object, mostly a subset of the {{domxref("Navigator")}} for browsing scopes, but adapted to workers. - {{domxref("origin", "WorkerGlobalScope.origin")}} {{ReadOnlyInline}} - : Returns the global object's origin, serialized as a string. -- {{domxref("performance_property", "WorkerGlobalScope.performance")}} {{ReadOnlyInline}} +- {{domxref("WorkerGlobalScope.performance")}} {{ReadOnlyInline}} - : Returns the {{domxref("Performance")}} associated with the worker. It is a regular performance object, except that only a subset of its property and methods are available to workers. - {{domxref("scheduler_property", "WorkerGlobalScope.scheduler")}} {{ReadOnlyInline}} - : Returns the {{domxref("Scheduler")}} object associated with the current context. This is the entry point for using the [Prioritized Task Scheduling API](/en-US/docs/Web/API/Prioritized_Task_Scheduling_API). diff --git a/files/en-us/web/api/workerglobalscope/performance/index.md b/files/en-us/web/api/workerglobalscope/performance/index.md new file mode 100644 index 000000000000000..7071ff4b729cca0 --- /dev/null +++ b/files/en-us/web/api/workerglobalscope/performance/index.md @@ -0,0 +1,33 @@ +--- +title: "WorkerGlobalScope: performance property" +short-title: performance +slug: Web/API/WorkerGlobalScope/performance +page-type: web-api-instance-property +browser-compat: api.performance +--- + +{{APIRef("Performance API")}} + +The **`performance`** property of the {{domxref("WorkerGlobalScope")}} interface returns a {{domxref("Performance")}} object, which can be used to gather performance information about the context it is called in worker. + +Performance entries are per context. If you create a mark on the main thread (or other worker), you cannot see it in a worker thread, and vice versa. + +## Value + +A {{domxref("Performance")}} object offering access to performance and timing-related information for the context it is called on worker. + +## Performance API availability + +See the table which provides an overview about the availability of the performance APIs in window and worker contexts at {{domxref("Window.performance")}}. + +## Specifications + +{{Specifications}} + +## Browser compatibility + +{{Compat}} + +## See also + +- {{domxref("Window.performance")}} diff --git a/files/en-us/web/javascript/reference/global_objects/date/gettime/index.md b/files/en-us/web/javascript/reference/global_objects/date/gettime/index.md index 383f6727abb2af6..0b7a9a1362c8a9a 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/gettime/index.md +++ b/files/en-us/web/javascript/reference/global_objects/date/gettime/index.md @@ -78,7 +78,7 @@ end = new Date(); console.log(`Operation took ${end.getTime() - start.getTime()} msec`); ``` -> **Note:** In browsers that support the {{domxref("performance_property", "Web Performance API", "", 1)}}'s high-resolution time feature, {{domxref("Performance.now()")}} can provide more reliable and precise measurements of elapsed time than {{jsxref("Date.now()")}}. +> **Note:** In browsers that support the {{domxref("Performance API", "", "", "nocode")}}'s high-resolution time feature, {{domxref("Performance.now()")}} can provide more reliable and precise measurements of elapsed time than {{jsxref("Date.now()")}}. ## Specifications diff --git a/files/en-us/web/javascript/reference/global_objects/date/index.md b/files/en-us/web/javascript/reference/global_objects/date/index.md index cd3b8512091e148..bea63d04cb8a3f9 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/index.md +++ b/files/en-us/web/javascript/reference/global_objects/date/index.md @@ -409,7 +409,7 @@ function printElapsedTime(testFn) { const yourFunctionReturn = printElapsedTime(yourFunction); ``` -> **Note:** In browsers that support the {{domxref("performance_property", "Web Performance API", "", 1)}}'s high-resolution time feature, {{domxref("Performance.now()")}} can provide more reliable and precise measurements of elapsed time than {{jsxref("Date.now()")}}. +> **Note:** In browsers that support the {{domxref("Performance API", "", "", "nocode")}}'s high-resolution time feature, {{domxref("Performance.now()")}} can provide more reliable and precise measurements of elapsed time than {{jsxref("Date.now()")}}. ### Get the number of seconds since the ECMAScript Epoch diff --git a/files/jsondata/GroupData.json b/files/jsondata/GroupData.json index 80e07c9cd1497a2..e0275264f93faea 100644 --- a/files/jsondata/GroupData.json +++ b/files/jsondata/GroupData.json @@ -1108,7 +1108,7 @@ "VisibilityStateEntry" ], "methods": [], - "properties": ["performance_property"], + "properties": ["Window.performance", "WorkerGlobalScope.performance"], "events": [] }, "Periodic Background Sync": { diff --git a/package.json b/package.json index aa3fe564fceb9a8..29e2c3b32e4d5dc 100644 --- a/package.json +++ b/package.json @@ -60,5 +60,6 @@ }, "devDependencies": { "jest": "^29.7.0" - } + }, + "packageManager": "yarn@1.22.19+sha1.4ba7fc5c6e704fce2066ecbfb0b0d8976fe62447" } From f23d7029fc89051aa239957f8de15af5678b23dd Mon Sep 17 00:00:00 2001 From: skyclouds2001 <95597335+skyclouds2001@users.noreply.github.com> Date: Wed, 1 May 2024 02:54:59 +0800 Subject: [PATCH 2/7] Update package.json --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index b1733fc6fd9e376..71c6a8044c75ec3 100644 --- a/package.json +++ b/package.json @@ -60,6 +60,5 @@ }, "devDependencies": { "jest": "^29.7.0" - }, - "packageManager": "yarn@1.22.19+sha1.4ba7fc5c6e704fce2066ecbfb0b0d8976fe62447" + } } From 46026eba8cf3d79e7a5eefe5e95f77740828cc2a Mon Sep 17 00:00:00 2001 From: skyclouds2001 <95597335+skyclouds2001@users.noreply.github.com> Date: Mon, 6 May 2024 20:31:10 +0800 Subject: [PATCH 3/7] Apply suggestions from code review Co-authored-by: wbamberg --- files/en-us/web/api/performance/index.md | 2 +- files/en-us/web/api/performance_api/index.md | 2 +- files/en-us/web/api/performance_api/performance_data/index.md | 2 +- files/en-us/web/api/window/performance/index.md | 4 ++-- files/en-us/web/api/workerglobalscope/performance/index.md | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/files/en-us/web/api/performance/index.md b/files/en-us/web/api/performance/index.md index fd4de6659bfe4f0..fe3630af28782a4 100644 --- a/files/en-us/web/api/performance/index.md +++ b/files/en-us/web/api/performance/index.md @@ -9,7 +9,7 @@ browser-compat: api.Performance The **`Performance`** interface provides access to performance-related information for the current page. -An object of this type can be obtained by calling `window.performance` or `self.performance` in workers. Note that Performance entries are per context. If you create a mark on the main thread (or other worker), you cannot see it in a worker thread, and vice versa. See {{domxref("window.performance")}} for which APIs are available in window and worker contexts. +Performance entries are specific to each execution context. You can access performance information for code running in a window via {{domxref("Window.performance")}}, and for code running in a worker via {{domxref("WorkerGlobalScope.performance")}}. {{InheritanceDiagram}} diff --git a/files/en-us/web/api/performance_api/index.md b/files/en-us/web/api/performance_api/index.md index 902151456caa3f1..d8fb59dfc92a9d2 100644 --- a/files/en-us/web/api/performance_api/index.md +++ b/files/en-us/web/api/performance_api/index.md @@ -29,7 +29,7 @@ Each performance metric is represented by a single {{domxref("PerformanceEntry") Most of the performance entries are recorded for you without you having to do anything, and are then accessible either through {{domxref("Performance.getEntries()")}} or (preferably) through {{domxref("PerformanceObserver")}}. For example, {{domxref("PerformanceEventTiming")}} entries are recorded for events that take longer than a set threshold. But the Performance API also enables you to define and record your own custom events, using the {{domxref("PerformanceMark")}} and {{domxref("PerformanceMeasure")}} interfaces. -The main {{domxref("Performance")}} interface is available for each global using {{domxref("Window.performance")}} or {{domxref("WorkerGlobalScope.performance")}} and enables you to add custom performance entries, to clear performance entries, and to retrieve performance entries. +The main {{domxref("Performance")}} interface is available in both {{domxref("Window.performance", "Window")}} and {{domxref("WorkerGlobalScope.performance", "Worker")}} global scopes, and enables you to add custom performance entries, to clear performance entries, and to retrieve performance entries. The {{domxref("PerformanceObserver")}} interface enables you to listen for various types of performance entry as they are recorded. diff --git a/files/en-us/web/api/performance_api/performance_data/index.md b/files/en-us/web/api/performance_api/performance_data/index.md index ec11d66f845c97f..aa4839e7e4fddec 100644 --- a/files/en-us/web/api/performance_api/performance_data/index.md +++ b/files/en-us/web/api/performance_api/performance_data/index.md @@ -22,7 +22,7 @@ For some metrics you do have to tell the browser what to measure: ## Performance data structure -The Performance API collects performance data for each global object (`window.performance` or `self.performance` in workers). See {{domxref("window.performance")}} for which APIs are available in window and worker contexts. If you are collecting performance metrics for multiple contexts, also take a look at {{domxref("performance.timeOrigin")}} to synchronize time origins between contexts. +With the Performance API you can collect performance data in both {{domxref("Window.performance", "Window")}} and {{domxref("WorkerGlobalScope.performance", "Worker")}} global contexts. If you are collecting performance metrics for multiple contexts, take a look at {{domxref("performance.timeOrigin")}} to synchronize time origins between contexts. Within these contexts, individual performance data is represented by performance entries. diff --git a/files/en-us/web/api/window/performance/index.md b/files/en-us/web/api/window/performance/index.md index 164f19c805b5410..6ec2e57e4bf015b 100644 --- a/files/en-us/web/api/window/performance/index.md +++ b/files/en-us/web/api/window/performance/index.md @@ -8,13 +8,13 @@ browser-compat: api.performance {{APIRef("Performance API")}} -The **`performance`** property of the {{domxref("Window")}} interface returns a {{domxref("Performance")}} object, which can be used to gather performance information about the context it is called in window. +The **`performance`** property of the {{domxref("Window")}} interface returns a {{domxref("Performance")}} object, which can be used to gather performance information about code running in the window's scope. Performance entries are per context. If you create a mark on the main thread (or other worker), you cannot see it in a worker thread, and vice versa. ## Value -A {{domxref("Performance")}} object offering access to performance and timing-related information for the context it is called on window. +A {{domxref("Performance")}} object offering access to performance and timing-related information about code running in the window's scope. ## Performance API availability diff --git a/files/en-us/web/api/workerglobalscope/performance/index.md b/files/en-us/web/api/workerglobalscope/performance/index.md index 7071ff4b729cca0..c06462cbdd0e598 100644 --- a/files/en-us/web/api/workerglobalscope/performance/index.md +++ b/files/en-us/web/api/workerglobalscope/performance/index.md @@ -8,9 +8,9 @@ browser-compat: api.performance {{APIRef("Performance API")}} -The **`performance`** property of the {{domxref("WorkerGlobalScope")}} interface returns a {{domxref("Performance")}} object, which can be used to gather performance information about the context it is called in worker. +The **`performance`** property of the {{domxref("WorkerGlobalScope")}} interface returns a {{domxref("Performance")}} object, which can be used to gather performance information about code running in the worker's scope. -Performance entries are per context. If you create a mark on the main thread (or other worker), you cannot see it in a worker thread, and vice versa. +Performance entries are per context. If you create a mark on a worker thread, you will not see it in the main thread or any other workers. ## Value From fd89b6610a019951a1b8ab8bad02e2012377dd87 Mon Sep 17 00:00:00 2001 From: skyclouds2001 Date: Mon, 6 May 2024 20:43:30 +0800 Subject: [PATCH 4/7] fix --- .../en-us/web/api/window/performance/index.md | 27 ------------------- .../workerglobalscope/performance/index.md | 15 ++++++++--- 2 files changed, 11 insertions(+), 31 deletions(-) diff --git a/files/en-us/web/api/window/performance/index.md b/files/en-us/web/api/window/performance/index.md index 6ec2e57e4bf015b..5876657f69924e5 100644 --- a/files/en-us/web/api/window/performance/index.md +++ b/files/en-us/web/api/window/performance/index.md @@ -16,33 +16,6 @@ Performance entries are per context. If you create a mark on the main thread (or A {{domxref("Performance")}} object offering access to performance and timing-related information about code running in the window's scope. -## Performance API availability - -The following table provides an overview about the availability of the performance APIs in window and worker contexts. - -| API | Window | Worker | -| ---------------------------------------------------------- | ------ | ------ | -| {{domxref("LargestContentfulPaint")}} | x | | -| {{domxref("LayoutShift")}} | x | | -| {{domxref("LayoutShiftAttribution")}} | x | | -| {{domxref("Performance")}} | x | x | -| {{domxref("PerformanceElementTiming")}} | x | | -| {{domxref("PerformanceEntry")}} | x | x | -| {{domxref("PerformanceEventTiming")}} | x | | -| {{domxref("PerformanceLongTaskTiming")}} | x | | -| {{domxref("PerformanceMark")}} | x | x | -| {{domxref("PerformanceMeasure")}} | x | x | -| {{domxref("PerformanceNavigation")}} {{deprecated_inline}} | x | | -| {{domxref("PerformanceNavigationTiming")}} | x | | -| {{domxref("PerformanceObserver")}} | x | x | -| {{domxref("PerformanceObserverEntryList")}} | x | x | -| {{domxref("PerformancePaintTiming")}} | x | | -| {{domxref("PerformanceResourceTiming")}} | x | x | -| {{domxref("PerformanceServerTiming")}} | x | x | -| {{domxref("PerformanceTiming")}} {{deprecated_inline}} | x | | -| {{domxref("TaskAttributionTiming")}} | x | | -| {{domxref("VisibilityStateEntry")}} | x | | - ## Specifications {{Specifications}} diff --git a/files/en-us/web/api/workerglobalscope/performance/index.md b/files/en-us/web/api/workerglobalscope/performance/index.md index c06462cbdd0e598..a2543247fa4859f 100644 --- a/files/en-us/web/api/workerglobalscope/performance/index.md +++ b/files/en-us/web/api/workerglobalscope/performance/index.md @@ -12,13 +12,20 @@ The **`performance`** property of the {{domxref("WorkerGlobalScope")}} interface Performance entries are per context. If you create a mark on a worker thread, you will not see it in the main thread or any other workers. -## Value +Note that only the following performance interfaces are available in worker contexts: -A {{domxref("Performance")}} object offering access to performance and timing-related information for the context it is called on worker. +- {{domxref("Performance")}} +- {{domxref("PerformanceEntry")}} +- {{domxref("PerformanceMark")}} +- {{domxref("PerformanceMeasure")}} +- {{domxref("PerformanceObserver")}} +- {{domxref("PerformanceObserverEntryList")}} +- {{domxref("PerformanceResourceTiming")}} +- {{domxref("PerformanceServerTiming")}} -## Performance API availability +## Value -See the table which provides an overview about the availability of the performance APIs in window and worker contexts at {{domxref("Window.performance")}}. +A {{domxref("Performance")}} object offering access to performance and timing-related information for the context it is called on worker. ## Specifications From 66000fa5c146276d56325082d265acf789c53696 Mon Sep 17 00:00:00 2001 From: wbamberg Date: Mon, 6 May 2024 10:03:15 -0700 Subject: [PATCH 5/7] Update files/en-us/web/api/workerglobalscope/index.md --- files/en-us/web/api/workerglobalscope/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/en-us/web/api/workerglobalscope/index.md b/files/en-us/web/api/workerglobalscope/index.md index 83edd2893bfb38a..c4dfb41b055790a 100644 --- a/files/en-us/web/api/workerglobalscope/index.md +++ b/files/en-us/web/api/workerglobalscope/index.md @@ -38,7 +38,7 @@ _This interface inherits properties from the {{domxref("EventTarget")}} interfac - {{domxref("WorkerGlobalScope.origin")}} {{ReadOnlyInline}} - : Returns the global object's origin, serialized as a string. - {{domxref("WorkerGlobalScope.performance")}} {{ReadOnlyInline}} - - : Returns the {{domxref("Performance")}} associated with the worker. It is a regular performance object, except that only a subset of its property and methods are available to workers. + - : Returns the {{domxref("Performance")}} associated with the worker. Only a subset of the properties and methods of the `Performance` interface are available to workers. - {{domxref("scheduler_property", "WorkerGlobalScope.scheduler")}} {{ReadOnlyInline}} - : Returns the {{domxref("Scheduler")}} object associated with the current context. This is the entry point for using the [Prioritized Task Scheduling API](/en-US/docs/Web/API/Prioritized_Task_Scheduling_API). - {{domxref("WorkerGlobalScope.self")}} {{ReadOnlyInline}} From a4ed5893f55ae8012d555797d3d14b9a21ed97f3 Mon Sep 17 00:00:00 2001 From: wbamberg Date: Mon, 6 May 2024 10:04:18 -0700 Subject: [PATCH 6/7] Update files/en-us/web/api/workerglobalscope/performance/index.md --- files/en-us/web/api/workerglobalscope/performance/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/en-us/web/api/workerglobalscope/performance/index.md b/files/en-us/web/api/workerglobalscope/performance/index.md index a2543247fa4859f..75cefd2d5052f7a 100644 --- a/files/en-us/web/api/workerglobalscope/performance/index.md +++ b/files/en-us/web/api/workerglobalscope/performance/index.md @@ -25,7 +25,7 @@ Note that only the following performance interfaces are available in worker cont ## Value -A {{domxref("Performance")}} object offering access to performance and timing-related information for the context it is called on worker. +A {{domxref("Performance")}} object offering access to performance and timing-related information for the context it is called on. ## Specifications From bf5c40fe480a6a214d3f2e0ff9b4bbee22e9db84 Mon Sep 17 00:00:00 2001 From: wbamberg Date: Mon, 6 May 2024 10:06:12 -0700 Subject: [PATCH 7/7] Update files/en-us/web/api/workerglobalscope/index.md Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- files/en-us/web/api/workerglobalscope/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/en-us/web/api/workerglobalscope/index.md b/files/en-us/web/api/workerglobalscope/index.md index c4dfb41b055790a..f2ea1a23b028803 100644 --- a/files/en-us/web/api/workerglobalscope/index.md +++ b/files/en-us/web/api/workerglobalscope/index.md @@ -38,7 +38,7 @@ _This interface inherits properties from the {{domxref("EventTarget")}} interfac - {{domxref("WorkerGlobalScope.origin")}} {{ReadOnlyInline}} - : Returns the global object's origin, serialized as a string. - {{domxref("WorkerGlobalScope.performance")}} {{ReadOnlyInline}} - - : Returns the {{domxref("Performance")}} associated with the worker. Only a subset of the properties and methods of the `Performance` interface are available to workers. + - : Returns the {{domxref("Performance")}} associated with the worker. Only a subset of the properties and methods of the `Performance` interface are available to workers. - {{domxref("scheduler_property", "WorkerGlobalScope.scheduler")}} {{ReadOnlyInline}} - : Returns the {{domxref("Scheduler")}} object associated with the current context. This is the entry point for using the [Prioritized Task Scheduling API](/en-US/docs/Web/API/Prioritized_Task_Scheduling_API). - {{domxref("WorkerGlobalScope.self")}} {{ReadOnlyInline}}