11 lines
544 B
HTML
11 lines
544 B
HTML
<!doctype html>
|
|
<title>Background</title>
|
|
<p>Counts what a page gets while its tab is hidden (S052).</p>
|
|
<script>
|
|
// raf / timer = calls while document.hidden; seen = visibilitychange events.
|
|
window.res = { raf: 0, timer: 0, seen: [] };
|
|
const frame = () => { if (document.hidden) window.res.raf++; requestAnimationFrame(frame); };
|
|
requestAnimationFrame(frame);
|
|
setInterval(() => { if (document.hidden) window.res.timer++; }, 10);
|
|
document.addEventListener("visibilitychange", () => window.res.seen.push(document.hidden));
|
|
</script>
|