Impacto direto em “user engagement and revenue”. Pode determinar seu ranking em social media e search. Internet para celular custa caro. Sobretudo em países emergentes ou em desenvolvimento. Why perceived performance matters?
new PerformanceObserver((list) => { let perfEntries = list.getEntries(); for (let i = 0; i < perfEntries.length; i++) { // report back for analytics and monitoring } }); // register observer for long task notifications observer.observe({entryTypes: [“paint]});
<hero /> performance.mark("hero-end"); performance.measure("hero-timing", "hero-start", "hero-end"); //report data to analytics let measures = performance.getEntriesByName("hero-timing"); let measure = measures[0]; sendToAnalytics(measure.duration);
!function(){if('PerformanceLongTaskTiming' in window){var g=window.__tti={e:[]}; g.o=new PerformanceObserver(function(l) {g.e=g.e.concat(l.getEntries())}); g.o.observe({entryTypes:['longtask']})}}(); </script> //import google polyfill https://github.com/GoogleChrome/tti- polyfill import ttiPolyfill from './path/to/tti-polyfill.js'; ttiPolyfill.getFirstConsistentlyInteractive(opts).then((tti) => { // report back for analytics and monitoring });