Guest User

Untitled

a guest
Jan 24th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. const html = `<html><head><script>!function(n,e){var t,o,i,c=[],f={passive:!0,capture:!0},r=new Date,a="pointerup",u="pointercancel";function p(n,c){t||(t=c,o=n,i=new Date,w(e),s())}function s(){o>=0&&o<i-r&&(c.forEach(function(n){n(o,t)}),c=[])}function l(t){if(t.cancelable){var o=(t.timeStamp>1e12?new Date:performance.now())-t.timeStamp;"pointerdown"==t.type?function(t,o){function i(){p(t,o),r()}function c(){r()}function r(){e(a,i,f),e(u,c,f)}n(a,i,f),n(u,c,f)}(o,t):p(o,t)}}function w(n){["click","mousedown","keydown","touchstart","pointerdown"].forEach(function(e){n(e,l,f)})}w(n),self.perfMetrics=self.perfMetrics||{},self.perfMetrics.onFirstInputDelay=function(n){c.push(n),s()}}(addEventListener,removeEventListener);</script></head><body><h1>First Input Delay</h1>
  2. <script>
  3. perfMetrics.onFirstInputDelay(function(delay, evt) {
  4. console.log('Delay: ', delay);
  5. console.log(evt);
  6. });
  7. </script>
  8. </body></html>`;
  9.  
  10. (async () => {
  11. const browser = await puppeteer.launch({
  12. headless: false,
  13. devtools: true
  14. })
  15. const page = await browser.newPage()
  16. await page.goto(`data:text/html, ${html}`)
  17. })()
Add Comment
Please, Sign In to add comment