Performance
Performance 对象,用于获取性能数据及创建性能监听器
支持情况:

方法
createObserver
创建全局性能事件监听器
支持情况:

(callback: Function) => PerformanceObserver
| 参数 | 类型 |
|---|---|
| callback | Function |
getEntries
该方法返回当前缓冲区中的所有性能数据
支持情况:

() => PerformanceEntry[]
getEntriesByName
获取当前缓冲区中所有名称为 [name] 且类型为 [entryType] 的性能数据
支持情况:

(name: string, entryType: string) => PerformanceEntry[]
| 参数 | 类型 |
|---|---|
| name | string |
| entryType | string |
getEntriesByType
获取当前缓冲区中所有类型为 [entryType] 的性能数据
支持情况:

(entryType: string) => PerformanceEntry[]
| 参数 | 类型 |
|---|---|
| entryType | string |
setBufferSize
设置缓冲区大小,默认缓冲 30 条性能数据
支持情况:

(size: number) => void
| 参数 | 类型 |
|---|---|
| size | number |
API 支持度
| API | 微信小程序 | H5 | React Native |
|---|---|---|---|
| Performance | ✔️ | ||
| Performance.createObserver | ✔️ | ||
| Performance.getEntries | ✔️ | ||
| Performance.getEntriesByName | ✔️ | ||
| Performance.getEntriesByType | ✔️ | ||
| Performance.setBufferSize | ✔️ |