项目
在 GitHub 查看
jamiebuilds/react-performance-observer
关于
Get performance measurements from React Fiber
网站与应用开发实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文react-performance-observer
Get performance measurements from React Fiber
Install
yarn add --dev react-performance-observer
Usage
react-performance-observer is a small abstraction over PerformanceObserver
which reports only the measurements that come from React and parses information
out of the name (See ReactDebugFiberPerf).
import { observe } from 'react-performance-observer';
observe(measurements => {
console.log(measurements);
// [
// {
// entryType: "measure",
// name: "⚛ App [mount]",
// componentName: "App",
// phase: "mount",
// startTime: 281,
// duration: 4,
// warning: null
// },
// ...
// ]
});
Or if you want to create your own PerformanceObserver you can use just the
parseEntry() method.
import { parseEntry } from 'react-performance-observer';
let observer = new window.PerformanceObserver(list => {
list.getEntries().forEach(entry => {
console.log(parseEntry(entry)); // parsed entry or null
});
});
This code was largely based on react-perf-devtool by @nitin42.
探索相关项目
加载中…