daily pastebin goal
58%
SHARE
TWEET

Untitled

a guest Jan 24th, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. })()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top