获取当前缓冲区中所有类型为 entryType 的性能数据。
xhs.getPerformance().getEntriesByType(entryType)
类型 | 默认值 | 必填 | 说明 |
|---|---|---|---|
| string | 无 | 是 | 期望获取的性能数据 |
Array
代码示例
const entries = xhs.getPerformance && xhs.getPerformance().getEntriesByType("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);
console.log("entry value: " + entries[i].value);
}