1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17

content / test / data / page_with_raf_counter.html [blame]

<!doctype html>
<h1>This page contains a RAF loop and does some measurements of the interval</h1>
<script>
var recent_time_stamps = new Array(10);
var raf_count = 0;

function reset_count() {
  raf_count = 0;
}
function on_raf(t) {
  raf_count++;
  recent_time_stamps.shift();
  recent_time_stamps.push(t);
  window.requestAnimationFrame(on_raf);
}
window.requestAnimationFrame(on_raf);
</script>