Last active
October 9, 2018 02:54
-
-
Save Zizzamia/0cbf9a216066a381044f8a037a8fafee to your computer and use it in GitHub Desktop.
tti-polyfill demo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <head> | |
| <script> | |
| !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> | |
| <style>body { background: #f2db77; ... } .progress { ... }</style> | |
| </head> | |
| <body>...</body> | |
| <script src="tti-polyfill.js"></script> | |
| <script> | |
| ttiPolyfill.getFirstConsistentlyInteractive() | |
| .then((tti) => { | |
| const elValue = document.querySelector('.js-tti-value'); | |
| elValue.textContent = tti + 'ms'; | |
| }); | |
| ... | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment