-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.js
52 lines (38 loc) · 1.12 KB
/
index.js
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
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import {Provider} from "react-redux";
import {PerformanceMetadataMarker} from "performance-mark-metadata";
import FpsEmitter from "fps-emitter";
//const { PerformanceMetadataMarker } = require("performance-mark-metadata");
//const FpsEmitter = require("fps-emitter");
import configureStore from "./configureStore";
const marker = new PerformanceMetadataMarker();
window.marker = marker;
const fps = new FpsEmitter();
fps.on("update", function(FPS) {
// mark current FPS
marker.mark("FPS", {
details: { FPS }
});
});
const getFpsStats = () => {
const logData = performance.getEntriesByType("mark").map(entry => {
const meta = marker.getEntryMetadata(entry);
return {
type: entry.name,
timeStamp: entry.startTime,
meta: meta
};
});
return logData;
}
window.getFpsStats = getFpsStats;
const store = configureStore();
ReactDOM.render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById('root')
);