Skip to content

Commit f32a3a5

Browse files
rshestfacebook-github-bot
authored andcommitted
Refactor PerformanceObserver public API
Summary: Changelog: [Internal] This is a follow-up to D40892974 (a671d61), addressing the post-land comments and discussions. Reviewed By: rubennorte Differential Revision: D40979654 fbshipit-source-id: 2e7e1d24be8211cc3363a07678745039e5606d8d
1 parent bbd432e commit f32a3a5

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

Libraries/WebPerformance/PerformanceObserver.js

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,16 @@
88
* @flow strict
99
*/
1010

11-
'use strict';
12-
13-
export type Timestamp = number;
14-
export type PerformanceEntryType = 'event';
11+
export type HighResTimeStamp = number;
12+
// TODO: Extend once new types (such as event) are supported
13+
export type PerformanceEntryType = empty;
1514

1615
export class PerformanceEntry {
1716
name: string;
1817
entryType: PerformanceEntryType;
19-
startTime: Timestamp;
18+
startTime: HighResTimeStamp;
2019
duration: number;
2120

22-
// For "event" entries only:
23-
processingStart: ?Timestamp;
24-
processingEnd: ?Timestamp;
25-
interactionId: ?number;
26-
2721
// $FlowIgnore: Flow(unclear-type)
2822
toJSON(): Object {
2923
return {
@@ -73,12 +67,10 @@ export type PerformanceObserverCallback = (
7367

7468
export type PerformanceObserverInit =
7569
| {
76-
entryTypes: PerformanceEntryType[],
77-
buffered?: boolean,
70+
entryTypes: Array<PerformanceEntryType>,
7871
}
7972
| {
8073
type: PerformanceEntryType,
81-
buffered?: boolean,
8274
};
8375

8476
/**
@@ -120,5 +112,7 @@ export default class PerformanceObserver {
120112
return [];
121113
}
122114

123-
static supportedEntryTypes: PerformanceEntryType[] = ['event'];
115+
static supportedEntryTypes: $ReadOnlyArray<PerformanceEntryType> =
116+
// TODO: add types once they are fully supported
117+
Object.freeze([]);
124118
}

0 commit comments

Comments
 (0)