+
95
-

js如何监控网页卡顿?

js如何监控网页卡顿?


网友回复

+
15
-

// 监控页面是否出现卡顿
const observer = new PerformanceObserver((list) => {
  for (const entry of list.getEntries()) {
    if (entry.duration > 100) {
      console.log('页面卡顿,上报到数据中...

点击查看剩余70%

我知道答案,我要回答