获取当前缓冲区中当前页面的性能数据。
xhs.getPerformance().getEntriesByPage(pagePath)
类型 | 默认值 | 必填 | 说明 |
---|---|---|---|
string | 无 | 是 | 期望获取性能数据页面的 pagePath |
Array
代码示例
const entries = xhs.getPerformance && xhs.getPerformance().getEntriesByPage("pages/index/index"); 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); }