Skip to main content
Version: 3.x

Performance

Performance 对象,用于获取性能数据及创建性能监听器

支持情况:

参考文档

方法​

createObserver​

创建全局性能事件监听器

支持情况:

参考文档

(callback: TaroGeneral.TFunc) => PerformanceObserver
参数类型
callbackTaroGeneral.TFunc

getEntries​

该方法返回当前缓冲区中的所有性能数据

支持情况:

参考文档

() => PerformanceEntry[]

getEntriesByName​

获取当前缓冲区中所有名称为 [name] 且类型为 [entryType] 的性能数据

支持情况:

参考文档

(name: string, entryType: string) => PerformanceEntry[]
参数类型
namestring
entryTypestring

getEntriesByType​

获取当前缓冲区中所有类型为 [entryType] 的性能数据

支持情况:

参考文档

(entryType: string) => PerformanceEntry[]
参数类型
entryTypestring

setBufferSize​

设置缓冲区大小,默认缓冲 30 条性能数据

支持情况:

参考文档

(size: number) => void
参数类型
sizenumber

API 支持度​

API微信小程序抖音小程序H5React NativeHarmonyASCF元服务
Performance✔️✔️
Performance.createObserver✔️
Performance.getEntries✔️✔️
Performance.getEntriesByName✔️✔️
Performance.getEntriesByType✔️✔️
Performance.setBufferSize✔️