Skip to content

Commit 5a5ce94

Browse files
authored
docs: initial docs for console.timeStamp (#4821)
1 parent 1ae2de9 commit 5a5ce94

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

docs/global-console.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,48 @@ title: console
88
:::
99

1010
The global `console` object, as defined in Web specifications.
11+
12+
---
13+
14+
## Methods
15+
16+
### `timeStamp()`
17+
18+
```tsx
19+
console.timeStamp(
20+
label: string,
21+
start?: string | number,
22+
end?: string | number,
23+
trackName?: string,
24+
trackGroup?: string,
25+
color?: DevToolsColor
26+
): void;
27+
```
28+
29+
The `console.timeStamp` API allows you to add custom timing entries in the Performance panel timeline.
30+
31+
**Parameters:**
32+
33+
| Name | Type | Required | Description |
34+
| ---------- | ------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
35+
| label | `string` | Yes | The label for the timing entry. |
36+
| start | `string \| number` | No | <ul><li>If string, the name of a previously recorded timestamp with `console.timeStamp`.</li><li>If number, the [DOMHighResTimeStamp](https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp). For example, from `performance.now()`.</li><li>If undefined, the current time is used.</li></ul> |
37+
| end | `string \| number` | No | <ul><li>If string, the name of a previously recorded timestamp with `console.timeStamp`.</li><li>If number, the [DOMHighResTimeStamp](https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp). For example, from `performance.now()`.</li><li>If undefined, the current time is used.</li></ul> |
38+
| trackName | `string` | No | The name of the custom track. |
39+
| trackGroup | `string` | No | The name of the track group. |
40+
| color | `DevToolsColor` | No | The color of the entry. |
41+
42+
```tsx
43+
type DevToolsColor =
44+
| 'primary'
45+
| 'primary-light'
46+
| 'primary-dark'
47+
| 'secondary'
48+
| 'secondary-light'
49+
| 'secondary-dark'
50+
| 'tertiary'
51+
| 'tertiary-light'
52+
| 'tertiary-dark'
53+
| 'warning'
54+
| 'error';
55+
```

0 commit comments

Comments
 (0)