Closed mehigh closed 2 years ago
@mehigh I need some context here. Not sure what I'm looking at to improve. ( Also that file/line you link does not exist anymore)
You mean to wrap this into window.addEventListener('load') ?
requestIdleCallback( function() { webVitalsAnalyticsScript = document.querySelector( 'script[data-src*="web-vitals-analytics.js"]' ); webVitalsAnalyticsScript.src = webVitalsAnalyticsScript.dataset.src; delete webVitalsAnalyticsScript.dataset.src; } );
Hi Manuel. Yes, that's what this refers to https://xwp-co.atlassian.net/wiki/spaces/KB/pages/2596208641/Total+Blocking+Time+Steps Please use a similar approach to the delayed load example in this section here. Default to 5000 (ms) and allow overriding with a filter which would be added to the readme. Thank you!
It might me a case that requestIdleCallback is executed right away and the lighthouse is picking up the change of src attribute, maybe we should change this to window.addEventListener('load') or setTimeout and inside that use requestIdleCallback with some timeout option?
https://github.com/xwp/site-performance-tracker/blob/master/php/Plugin.php#L84