Skip to content

Commit 328332a

Browse files
authored
Initial docs for experimental Web Performance APIs (#4792)
* Initial docs for experimental Web Performance APIs * Add experimental and canary banners * Fix lint issue with casing * Improve admonitions * Consistency in release channels banners * Fix description of rnStartupTiming.startTime
1 parent aaab017 commit 328332a

12 files changed

+248
-4
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
:::tip Canary 🧪
2+
3+
**This API is currently only available in React Native’s Canary and Experimental channels.**
4+
5+
If you want to try it out, please [enable the Canary Channel](releases/release-levels) in your app.
6+
7+
:::
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
:::tip Experimental Feature 🧪
2+
3+
**This API is currently only available in React Native’s Experimental channels.**
4+
5+
Experimental APIs may contain bugs and are likely to change in a future version of React Native. Don't use them in production.
6+
7+
If you want to try it out, please [enable the Experimental Channel](releases/release-levels) in your app.
8+
9+
:::

docs/global-EventCounts.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
id: global-EventCounts
3+
title: EventCounts 🧪
4+
---
5+
6+
import CanaryAPIWarning from './\_canary-channel-api-warning.mdx';
7+
8+
<CanaryAPIWarning />
9+
10+
The global [`EventCounts`](https://developer.mozilla.org/en-US/docs/Web/API/EventCounts) class, as defined in Web specifications.

docs/global-PerformanceEntry.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
id: global-PerformanceEntry
3+
title: PerformanceEntry 🧪
4+
---
5+
6+
import CanaryAPIWarning from './\_canary-channel-api-warning.mdx';
7+
8+
<CanaryAPIWarning />
9+
10+
The global [`PerformanceEntry`](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry) class, as defined in Web specifications.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
id: global-PerformanceEventTiming
3+
title: PerformanceEventTiming 🧪
4+
---
5+
6+
import CanaryAPIWarning from './\_canary-channel-api-warning.mdx';
7+
8+
<CanaryAPIWarning />
9+
10+
The global [`PerformanceEventTiming`](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEventTiming) class, as defined in Web specifications.
11+
12+
:::warning Partial support
13+
The `cancelable` and `target` properties are not supported yet.
14+
:::
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
id: global-PerformanceLongTaskTiming
3+
title: PerformanceLongTaskTiming 🧪
4+
---
5+
6+
import CanaryAPIWarning from './\_canary-channel-api-warning.mdx';
7+
8+
<CanaryAPIWarning />
9+
10+
The global [`PerformanceLongTaskTiming`](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceLongTaskTiming) class, as defined in Web specifications.
11+
12+
:::warning Partial support
13+
The value for the `attribution` property is always an empty array.
14+
:::

docs/global-PerformanceMark.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
id: global-PerformanceMark
3+
title: PerformanceMark 🧪
4+
---
5+
6+
import CanaryAPIWarning from './\_canary-channel-api-warning.mdx';
7+
8+
<CanaryAPIWarning />
9+
10+
The global [`PerformanceMark`](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceMark) class, as defined in Web specifications.

docs/global-PerformanceMeasure.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
id: global-PerformanceMeasure
3+
title: PerformanceMeasure 🧪
4+
---
5+
6+
import CanaryAPIWarning from './\_canary-channel-api-warning.mdx';
7+
8+
<CanaryAPIWarning />
9+
10+
The global [`PerformanceMeasure`](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceMeasure) class, as defined in Web specifications.

docs/global-PerformanceObserver.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
id: global-PerformanceObserver
3+
title: PerformanceObserver 🧪
4+
---
5+
6+
import CanaryAPIWarning from './\_canary-channel-api-warning.mdx';
7+
8+
<CanaryAPIWarning />
9+
10+
The global [`PerformanceObserver`](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver) class, as defined in Web specifications.
11+
12+
## Example
13+
14+
```ts
15+
const observer = new PerformanceObserver(
16+
(list, observer, options) => {
17+
for (const entry of list.getEntries()) {
18+
console.log(
19+
'Received entry with type',
20+
entry.entryType,
21+
'and name',
22+
entry.name,
23+
'that started at',
24+
entry.startTime,
25+
'and took',
26+
entry.duration,
27+
'ms',
28+
);
29+
}
30+
},
31+
);
32+
33+
observer.observe({entryTypes: ['mark', 'measure']});
34+
```
35+
36+
---
37+
38+
# Reference
39+
40+
## Constructor
41+
42+
### `PerformanceObserver()`
43+
44+
See [documentation in MDN](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver/PerformanceObserver).
45+
46+
## Static properties
47+
48+
### `supportedEntryTypes`
49+
50+
See [documentation in MDN](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver/supportedEntryTypes).
51+
52+
Returns `['mark', 'measure', 'event', 'longtask']`.
53+
54+
## Instance methods
55+
56+
### `observe()`
57+
58+
See [documentation in MDN](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver/observe).
59+
60+
### `disconnect()`
61+
62+
See [documentation in MDN](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver/disconnect).
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
id: global-PerformanceObserverEntryList
3+
title: PerformanceObserverEntryList 🧪
4+
---
5+
6+
import CanaryAPIWarning from './\_canary-channel-api-warning.mdx';
7+
8+
<CanaryAPIWarning />
9+
10+
The global [`PerformanceObserverEntryList`](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserverEntryList) class, as defined in Web specifications.

0 commit comments

Comments
 (0)