mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
afd954efbb
Summary: Changelog: [Internal] This adds definition of `PerformanceEventTiming` interface, according to the W3C standard, so that [event timing](https://www.w3.org/TR/event-timing) data can be reported from native (the C++ part is in the next diff). See here: https://www.w3.org/TR/event-timing/#performanceeventtiming Reviewed By: christophpurrer Differential Revision: D42279486 fbshipit-source-id: 0dfbcd6e5a08fc1b89651bd35b24fb4e731f8b05
46 lines
1.0 KiB
JavaScript
46 lines
1.0 KiB
JavaScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format
|
|
* @flow strict
|
|
*/
|
|
|
|
export type HighResTimeStamp = number;
|
|
export type PerformanceEntryType = 'mark' | 'measure' | 'event' | 'first-input';
|
|
|
|
export class PerformanceEntry {
|
|
name: string;
|
|
entryType: PerformanceEntryType;
|
|
startTime: HighResTimeStamp;
|
|
duration: HighResTimeStamp;
|
|
|
|
constructor(init: {
|
|
name: string,
|
|
entryType: PerformanceEntryType,
|
|
startTime: HighResTimeStamp,
|
|
duration: HighResTimeStamp,
|
|
}) {
|
|
this.name = init.name;
|
|
this.entryType = init.entryType;
|
|
this.startTime = init.startTime;
|
|
this.duration = init.duration;
|
|
}
|
|
|
|
toJSON(): {
|
|
name: string,
|
|
entryType: PerformanceEntryType,
|
|
startTime: HighResTimeStamp,
|
|
duration: HighResTimeStamp,
|
|
} {
|
|
return {
|
|
name: this.name,
|
|
entryType: this.entryType,
|
|
startTime: this.startTime,
|
|
duration: this.duration,
|
|
};
|
|
}
|
|
}
|