-
Notifications
You must be signed in to change notification settings - Fork 24
/
hr_time.dart
192 lines (176 loc) · 8.12 KB
/
hr_time.dart
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
//
// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web).
// Attributions and copyright licensing by Mozilla Contributors is licensed
// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/.
// Generated from Web IDL definitions.
@JS()
library;
import 'dart:js_interop';
import 'dom.dart';
import 'html.dart';
import 'navigation_timing.dart';
import 'performance_timeline.dart';
import 'user_timing.dart';
typedef DOMHighResTimeStamp = num;
typedef EpochTimeStamp = int;
/// 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`](https://developer.mozilla.org/en-US/docs/Web/API/performance_property)
/// for which APIs are available in window and worker contexts.
///
/// ---
///
/// API documentation sourced from
/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/Performance).
extension type Performance._(JSObject _) implements EventTarget, JSObject {
/// The **`performance.now()`** method returns a high resolution timestamp in
/// milliseconds. It represents the time elapsed since
/// [Performance.timeOrigin] (the time when navigation has started in window
/// contexts, or the time when the worker is run in [Worker] and
/// [ServiceWorker] contexts).
external DOMHighResTimeStamp now();
/// The **`toJSON()`** method of the [Performance] interface is a ; it returns
/// a JSON representation of the [Performance] object.
external JSObject toJSON();
/// The **`getEntries()`** method returns an array of all [PerformanceEntry]
/// objects currently present in the performance timeline.
///
/// If you are only interested in performance entries of certain types or that
/// have certain names, see [Performance.getEntriesByType] and
/// [Performance.getEntriesByName].
///
/// > **Note:** This method does not notify you about new performance entries;
/// > you will only get entries that are present in the performance timeline
/// > at the time you call this method.
/// > To receive notifications about entries as they become available, use a
/// > [PerformanceObserver].
///
/// The following entry types are not supported by this method at all and
/// won't be returned even if entries for these types might exist:
///
/// - `"element"` ([PerformanceElementTiming])
/// - `"event"` ([PerformanceEventTiming])
/// - `"largest-contentful-paint"` ([LargestContentfulPaint])
/// - `"layout-shift"` ([LayoutShift])
/// - `"longtask"` ([PerformanceLongTaskTiming])
///
/// To access entries of these types, you must use a [PerformanceObserver]
/// instead.
external PerformanceEntryList getEntries();
/// The **`getEntriesByType()`** method returns an array of [PerformanceEntry]
/// objects currently present in the performance timeline for a given _type_.
///
/// If you are interested in performance entries of certain name, see
/// [Performance.getEntriesByName]. For all performance entries, see
/// [Performance.getEntries].
///
/// > **Note:** This method does not notify you about new performance entries;
/// > you will only get entries that are present in the performance timeline
/// > at the time you call this method.
/// > To receive notifications about entries as they become available, use a
/// > [PerformanceObserver].
///
/// The following entry types are not supported by this method at all and
/// won't be returned even if entries for these types might exist:
///
/// - `"element"` ([PerformanceElementTiming])
/// - `"event"` ([PerformanceEventTiming])
/// - `"largest-contentful-paint"` ([LargestContentfulPaint])
/// - `"layout-shift"` ([LayoutShift])
/// - `"longtask"` ([PerformanceLongTaskTiming])
///
/// To access entries of these types, you must use a [PerformanceObserver]
/// instead.
external PerformanceEntryList getEntriesByType(String type);
/// The **`getEntriesByName()`** method returns an array of [PerformanceEntry]
/// objects currently present in the performance timeline with the given
/// _name_ and _type_.
///
/// If you are interested in performance entries of certain types, see
/// [Performance.getEntriesByType]. For all performance entries, see
/// [Performance.getEntries].
///
/// > **Note:** This method does not notify you about new performance entries;
/// > you will only get entries that are present in the performance timeline
/// > at the time you call this method.
/// > To receive notifications about entries as they become available, use a
/// > [PerformanceObserver].
///
/// The following entry types are not supported by this method at all and
/// won't be returned even if entries for these types might exist:
///
/// - `"element"` ([PerformanceElementTiming])
/// - `"event"` ([PerformanceEventTiming])
/// - `"largest-contentful-paint"` ([LargestContentfulPaint])
/// - `"layout-shift"` ([LayoutShift])
/// - `"longtask"` ([PerformanceLongTaskTiming])
///
/// To access entries of these types, you must use a [PerformanceObserver]
/// instead.
external PerformanceEntryList getEntriesByName(
String name, [
String type,
]);
/// The **`clearResourceTimings()`** method removes all performance entries
/// with an [PerformanceEntry.entryType] of "`resource`" from the browser's
/// performance timeline and sets the size of the performance resource data
/// buffer to zero.
///
/// To set the size of the browser's performance resource data buffer, use the
/// [Performance.setResourceTimingBufferSize] method.
///
/// To get notified when the browser's resource timing buffer is full, listen
/// for the [Performance.resourcetimingbufferfull_event] event.
external void clearResourceTimings();
/// The **`setResourceTimingBufferSize()`** method sets the desired size of
/// the browser's resource timing buffer which stores the "`resource`"
/// performance entries.
///
/// The specification requires the resource timing buffer initially to be 250
/// or greater.
///
/// To clear the browser's performance resource data buffer, use the
/// [Performance.clearResourceTimings] method.
///
/// To get notified when the browser's resource timing buffer is full, listen
/// for the [Performance.resourcetimingbufferfull_event] event.
external void setResourceTimingBufferSize(int maxSize);
/// The **`mark()`** method creates a named [PerformanceMark] object
/// representing a high resolution timestamp marker in the browser's
/// performance timeline.
external PerformanceMark mark(
String markName, [
PerformanceMarkOptions markOptions,
]);
/// The **`clearMarks()`** method removes all or specific [PerformanceMark]
/// objects from the browser's performance timeline.
external void clearMarks([String markName]);
/// The **`measure()`** method creates a named [PerformanceMeasure] object
/// representing a time measurement between two marks in the browser's
/// performance timeline.
///
/// When measuring between two marks, there is a _start mark_ and _end mark_,
/// respectively.
/// The named timestamp is referred to as a _measure_.
external PerformanceMeasure measure(
String measureName, [
JSAny startOrMeasureOptions,
String endMark,
]);
/// The **`clearMeasures()`** method removes all or specific
/// [PerformanceMeasure] objects from the browser's performance timeline.
external void clearMeasures([String measureName]);
external DOMHighResTimeStamp get timeOrigin;
external PerformanceTiming get timing;
external PerformanceNavigation get navigation;
external set onresourcetimingbufferfull(EventHandler value);
external EventHandler get onresourcetimingbufferfull;
}