tt.performance.getEntriesByName
基础库 1.60.0 开始支持本方法,低版本需做兼容处理。这是一个同步方法。
获取当前缓冲区中所有名称为 [name] 且类型为 [entryType] 的性能数据。
语法
tt.performance.getEntriesByName(name, entryType)
参数说明
name
类型 | 默认值 | 必填 | 说明 |
---|---|---|---|
string | 是 | 期望获取的性能数据 name |
entryType
类型 | 默认值 | 必填 | 说明 |
---|---|---|---|
string | 否 | 期望获取的性能数据 entryType |
返回值
Array, PerformanceEntry 集合。
代码示例
const entries = tt.performance && tt.performance.getEntriesByName("first-paint", "paint");
for (let i = 0, len = entries.length; i < len; i++) {
console.log("entry name: " + entries[i].name);
console.log("entry entryType: " + entries[i].entryType);
console.log("entry startTime: " + entries[i].startTime);
console.log("entry duration: " + entries[i].duration);
}
Bug & Tip
无
点击纠错
评价此篇文档