提交 c294ad0a 编写于 作者: C Christopher Snyder 提交者: Joe Haddad

Fix missing quotes around `in` operator check for PerformanceObserver (#10018)

* Fix missing quotes around `in` operator check for PerformanceObserver

* Always call `getEntriesByType()` even if performance observer is supported.
Co-authored-by: NJoe Haddad <timer150@gmail.com>
上级 3dc4a687
......@@ -294,11 +294,15 @@ function renderReactElement(reactEl, domEl) {
}
if (onPerfEntry && ST) {
if (!(PerformanceObserver in window)) {
if (!('PerformanceObserver' in window)) {
window.addEventListener('load', () => {
performance.getEntriesByType('paint').forEach(onPerfEntry)
})
} else {
performance.getEntriesByType('paint').forEach(onPerfEntry)
// Start an observer to catch any paint metrics which may fire _after_
// the load event is fired on the window
const observer = new PerformanceObserver(list => {
list.getEntries().forEach(onPerfEntry)
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册