/
browserProfiler.d.ts
54 lines (51 loc) · 1.27 KB
/
browserProfiler.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
export {};
declare global {
interface Window {
Profiler: Profiler | undefined;
}
interface Profiler extends EventTarget {
readonly stopped: boolean;
readonly sampleInterval: DOMHighResTimeStamp;
new (options: ProfilerInitOptions): Profiler;
stop(): Promise<ProfilerTrace>;
}
interface ProfilerTrace {
resources: ProfilerResource[];
frames: ProfilerFrame[];
stacks: ProfilerStack[];
samples: ProfilerSample[];
}
interface ProfilerInitOptions {
sampleInterval: DOMHighResTimeStamp;
maxBufferSize: number;
}
interface ProfilerFrame {
readonly name: string;
readonly resourceId?: number;
readonly line?: number;
readonly column?: number;
}
interface ProfilerStack {
readonly parentId?: number;
readonly frameId: number;
}
interface ProfilerSample {
readonly timestamp: DOMHighResTimeStamp;
readonly stackId?: number;
/*
The markers extension
https://github.com/WICG/js-self-profiling/blob/main/markers.md
Unfortunately not available as of today.
https://chromestatus.com/feature/5676352050036736
*/
marker?: ProfilerMarker;
}
type ProfilerResource = string;
type ProfilerMarker =
| 'script'
| 'gc'
| 'style'
| 'layout'
| 'paint'
| 'other';
}