Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Just add a bookmark with below text as its content. */
- javascript:(function(){
- var meter = `
- <label style="position:fixed; z-index:10000; top: 0; left: 50%; transform: translateX(-50%); background-color: pink; padding: 5px;">
- Main thread jank (0-500ms): <input id="jankmeter" type="range" min=0 max=500 value=50>
- </label>
- `;
- const d = document.createElement('jank');
- d.innerHTML = meter;
- document.body.appendChild(d);
- requestAnimationFrame(function jank() {
- requestAnimationFrame(jank);
- const range = document.querySelector('input[type=range]#jankmeter');
- const start = performance.now();
- while(performance.now() - start < range.value);
- });
- })();
Add Comment
Please, Sign In to add comment