Guest User

Untitled

a guest
Jan 23rd, 2019
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. var resources = window.performance.getEntries("resource");
  2.  
  3. var blocking = resources.filter(function(entry){
  4. return entry.initiatorType == 'script' || entry.initiatorType == 'link' || entry.initiatorType == 'css' ;
  5. });
  6.  
  7. var syncronous = blocking.filter(function(entry){
  8. let interactive = window.performance.timing.domInteractive - window.performance.timing.fetchStart;
  9. return entry.startTime < interactive;
  10. });
  11.  
  12.  
  13. var maxTime = Math.max(...syncronous.map(o => o.responseEnd), 0);
  14.  
  15. console.log("DOM Interactive at: " + maxTime);
Add Comment
Please, Sign In to add comment