new PerformanceObserver(cb).observe({ type: 'paint', buffered: true }) 在 Safari 中不起作用

new PerformanceObserver(cb).observe({ type: 'paint', buffered: true }) doesn't work in Safari

new PerformanceObserver((list) => {
  list.getEntries().forEach(console.log);
}).observe({ type: 'paint', buffered: true });
performance.getEntriesByType('paint').forEach(console.log);

这两个片段记录了 Chrome、Firefox、Edge 和 Opera 中匹配的绘画条目。但是,在 Safari 15.3 中,PerformanceObserver 方法根本不会记录(不会调用回调),但 getEntriesByType 方法会记录“first-contentful-paint”条目。好像是 Safari supports PerformanceObserver.observe and supports the PerformancePaintTiming API为什么上述 PerformanceObserver 方法在 Safari 中不起作用?

如果 Safari 中存在错误,您认为 getEntriesByTypes 没有 PerformanceObserver 的 buffer 可以代替使用吗?谢谢。

这是在 Safari 中进行的。关注这个错误:查看它:https://bugs.webkit.org/show_bug.cgi?id=225305

If there is a bug in Safari do you think that getEntriesByTypes without a PerformanceObserver's buffer is OK to use instead? Thanks.

没有 buffered 选项的问题是您可能会错过在注册观察者之前发生的观察。在这里看到我注意到事件是否被测量不一致的地方:https://github.com/GoogleChrome/web-vitals/pull/139