diff --git a/docs/_canary-channel-api-warning.mdx b/docs/_canary-channel-api-warning.mdx new file mode 100644 index 00000000000..e8b3934b850 --- /dev/null +++ b/docs/_canary-channel-api-warning.mdx @@ -0,0 +1,7 @@ +:::tip Canary 🧪 + +**This API is currently only available in React Native’s Canary and Experimental channels.** + +If you want to try it out, please [enable the Canary Channel](releases/release-levels) in your app. + +::: diff --git a/docs/_experimental-channel-api-warning.mdx b/docs/_experimental-channel-api-warning.mdx new file mode 100644 index 00000000000..8f290343124 --- /dev/null +++ b/docs/_experimental-channel-api-warning.mdx @@ -0,0 +1,9 @@ +:::tip Experimental Feature 🧪 + +**This API is currently only available in React Native’s Experimental channels.** + +Experimental APIs may contain bugs and are likely to change in a future version of React Native. Don't use them in production. + +If you want to try it out, please [enable the Experimental Channel](releases/release-levels) in your app. + +::: diff --git a/docs/global-EventCounts.md b/docs/global-EventCounts.md new file mode 100644 index 00000000000..ee1e0347e3e --- /dev/null +++ b/docs/global-EventCounts.md @@ -0,0 +1,10 @@ +--- +id: global-EventCounts +title: EventCounts 🧪 +--- + +import CanaryAPIWarning from './\_canary-channel-api-warning.mdx'; + + + +The global [`EventCounts`](https://developer.mozilla.org/en-US/docs/Web/API/EventCounts) class, as defined in Web specifications. diff --git a/docs/global-PerformanceEntry.md b/docs/global-PerformanceEntry.md new file mode 100644 index 00000000000..4f24c425452 --- /dev/null +++ b/docs/global-PerformanceEntry.md @@ -0,0 +1,10 @@ +--- +id: global-PerformanceEntry +title: PerformanceEntry 🧪 +--- + +import CanaryAPIWarning from './\_canary-channel-api-warning.mdx'; + + + +The global [`PerformanceEntry`](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry) class, as defined in Web specifications. diff --git a/docs/global-PerformanceEventTiming.md b/docs/global-PerformanceEventTiming.md new file mode 100644 index 00000000000..1aff347700a --- /dev/null +++ b/docs/global-PerformanceEventTiming.md @@ -0,0 +1,14 @@ +--- +id: global-PerformanceEventTiming +title: PerformanceEventTiming 🧪 +--- + +import CanaryAPIWarning from './\_canary-channel-api-warning.mdx'; + + + +The global [`PerformanceEventTiming`](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEventTiming) class, as defined in Web specifications. + +:::warning Partial support +The `cancelable` and `target` properties are not supported yet. +::: diff --git a/docs/global-PerformanceLongTaskTiming.md b/docs/global-PerformanceLongTaskTiming.md new file mode 100644 index 00000000000..ab2804a1a9c --- /dev/null +++ b/docs/global-PerformanceLongTaskTiming.md @@ -0,0 +1,14 @@ +--- +id: global-PerformanceLongTaskTiming +title: PerformanceLongTaskTiming 🧪 +--- + +import CanaryAPIWarning from './\_canary-channel-api-warning.mdx'; + + + +The global [`PerformanceLongTaskTiming`](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceLongTaskTiming) class, as defined in Web specifications. + +:::warning Partial support +The value for the `attribution` property is always an empty array. +::: diff --git a/docs/global-PerformanceMark.md b/docs/global-PerformanceMark.md new file mode 100644 index 00000000000..a1281387d6a --- /dev/null +++ b/docs/global-PerformanceMark.md @@ -0,0 +1,10 @@ +--- +id: global-PerformanceMark +title: PerformanceMark 🧪 +--- + +import CanaryAPIWarning from './\_canary-channel-api-warning.mdx'; + + + +The global [`PerformanceMark`](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceMark) class, as defined in Web specifications. diff --git a/docs/global-PerformanceMeasure.md b/docs/global-PerformanceMeasure.md new file mode 100644 index 00000000000..d5fd54a8f97 --- /dev/null +++ b/docs/global-PerformanceMeasure.md @@ -0,0 +1,10 @@ +--- +id: global-PerformanceMeasure +title: PerformanceMeasure 🧪 +--- + +import CanaryAPIWarning from './\_canary-channel-api-warning.mdx'; + + + +The global [`PerformanceMeasure`](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceMeasure) class, as defined in Web specifications. diff --git a/docs/global-PerformanceObserver.md b/docs/global-PerformanceObserver.md new file mode 100644 index 00000000000..103bb1b377a --- /dev/null +++ b/docs/global-PerformanceObserver.md @@ -0,0 +1,62 @@ +--- +id: global-PerformanceObserver +title: PerformanceObserver 🧪 +--- + +import CanaryAPIWarning from './\_canary-channel-api-warning.mdx'; + + + +The global [`PerformanceObserver`](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver) class, as defined in Web specifications. + +## Example + +```ts +const observer = new PerformanceObserver( + (list, observer, options) => { + for (const entry of list.getEntries()) { + console.log( + 'Received entry with type', + entry.entryType, + 'and name', + entry.name, + 'that started at', + entry.startTime, + 'and took', + entry.duration, + 'ms', + ); + } + }, +); + +observer.observe({entryTypes: ['mark', 'measure']}); +``` + +--- + +# Reference + +## Constructor + +### `PerformanceObserver()` + +See [documentation in MDN](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver/PerformanceObserver). + +## Static properties + +### `supportedEntryTypes` + +See [documentation in MDN](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver/supportedEntryTypes). + +Returns `['mark', 'measure', 'event', 'longtask']`. + +## Instance methods + +### `observe()` + +See [documentation in MDN](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver/observe). + +### `disconnect()` + +See [documentation in MDN](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver/disconnect). diff --git a/docs/global-PerformanceObserverEntryList.md b/docs/global-PerformanceObserverEntryList.md new file mode 100644 index 00000000000..367450b6d16 --- /dev/null +++ b/docs/global-PerformanceObserverEntryList.md @@ -0,0 +1,10 @@ +--- +id: global-PerformanceObserverEntryList +title: PerformanceObserverEntryList 🧪 +--- + +import CanaryAPIWarning from './\_canary-channel-api-warning.mdx'; + + + +The global [`PerformanceObserverEntryList`](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserverEntryList) class, as defined in Web specifications. diff --git a/docs/global-performance.md b/docs/global-performance.md index d83d816fa3f..bda3d17c991 100644 --- a/docs/global-performance.md +++ b/docs/global-performance.md @@ -1,10 +1,90 @@ --- id: global-performance -title: performance +title: performance 🧪 --- -:::warning -🚧 This page is work in progress, so please refer to the [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/API/performance) for more information. +import CanaryAPIWarning from './\_canary-channel-api-warning.mdx'; + + + +The global [`performance`](https://developer.mozilla.org/en-US/docs/Web/API/Window/performance) object, as defined in Web specifications. + +--- + +# Reference + +## Instance properties + +### `eventCounts` + +See [documentation in MDN](https://developer.mozilla.org/en-US/docs/Web/API/Performance/eventCounts). + +### `memory` + +See [documentation in MDN](https://developer.mozilla.org/en-US/docs/Web/API/Performance/memory). + +### `rnStartupTiming` ⚠️ + +:::warning Non-standard +This is a React Native specific extension. +::: + +Provides information about the startup time of the application. + +```ts +get rnStartupTiming(): ReactNativeStartupTiming; +``` + +The `ReactNativeStartupTiming` interface provides the following fields: + +| Name | Type | Description | +| ---------------------------------------- | -------------- | --------------------------------------------------------- | +| `startTime` | number \| void | When the React Native runtime initialization was started. | +| `executeJavaScriptBundleEntryPointStart` | number \| void | When the execution of the application bundle was started. | +| `endTime` | number \| void | When the React Native runtime was fully initialized. | + +### `timeOrigin` + +:::warning Partial support +Provides the number of milliseconds from the UNIX epoch until system boot, instead of the number of milliseconds from the UNIX epoch until app startup. +::: + +See [documentation in MDN](https://developer.mozilla.org/en-US/docs/Web/API/Performance/timeOrigin). + +## Instance methods + +### `clearMarks()` + +See [documentation in MDN](https://developer.mozilla.org/en-US/docs/Web/API/Performance/clearMarks). + +### `clearMeasures()` + +See [documentation in MDN](https://developer.mozilla.org/en-US/docs/Web/API/Performance/clearMeasures). + +### `getEntries()` + +See [documentation in MDN](https://developer.mozilla.org/en-US/docs/Web/API/Performance/getEntries). + +### `getEntriesByName()` + +See [documentation in MDN](https://developer.mozilla.org/en-US/docs/Web/API/Performance/getEntriesByName). + +### `getEntriesByType()` + +See [documentation in MDN](https://developer.mozilla.org/en-US/docs/Web/API/Performance/getEntriesByType). + +### `mark()` + +See [documentation in MDN](https://developer.mozilla.org/en-US/docs/Web/API/Performance/mark). + +### `measure()` + +See [documentation in MDN](https://developer.mozilla.org/en-US/docs/Web/API/Performance/measure). + +### `now()` + +:::warning Partial support +Provides the number of milliseconds from system boot, instead of the number of milliseconds from app startup. ::: -The global `performance` object, as defined in Web specifications. +See [documentation in MDN](https://developer.mozilla.org/en-US/docs/Web/API/Performance/now). diff --git a/website/sidebars.ts b/website/sidebars.ts index 9288c5018ea..1bdb864503a 100644 --- a/website/sidebars.ts +++ b/website/sidebars.ts @@ -240,6 +240,7 @@ export default { 'global-clearInterval', 'global-clearTimeout', 'global-console', + 'global-EventCounts', 'global-fetch', 'global-File', 'global-FileReader', @@ -248,6 +249,13 @@ export default { 'global-Headers', 'global-navigator', 'global-performance', + 'global-PerformanceEntry', + 'global-PerformanceEventTiming', + 'global-PerformanceLongTaskTiming', + 'global-PerformanceMark', + 'global-PerformanceMeasure', + 'global-PerformanceObserver', + 'global-PerformanceObserverEntryList', 'global-process', 'global-queueMicrotask', 'global-Request',