Guest User

Untitled

a guest
Aug 17th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. /* Just add a bookmark with below text as its content. */
  2. javascript:(function(){
  3. var meter = `
  4. <label style="position:fixed; z-index:10000; top: 0; left: 50%; transform: translateX(-50%); background-color: pink; padding: 5px;">
  5. Main thread jank (0-500ms): <input id="jankmeter" type="range" min=0 max=500 value=50>
  6. </label>
  7. `;
  8.  
  9. const d = document.createElement('jank');
  10. d.innerHTML = meter;
  11. document.body.appendChild(d);
  12.  
  13. requestAnimationFrame(function jank() {
  14. requestAnimationFrame(jank);
  15. const range = document.querySelector('input[type=range]#jankmeter');
  16. const start = performance.now();
  17. while(performance.now() - start < range.value);
  18. });
  19. })();
Add Comment
Please, Sign In to add comment