requestAnimationFrame

In notebook:
FrontEndMasters Real-Time Web with Node.js
Created at:
2015-10-12
Updated:
2015-10-12
Tags:
JavaScript animation Fundamentals
Video Course on Real-Time HTML5 with Node.jsa poorly named API

it's not only about animation, can be any kind of visual update

"call this function at the most optimal time for a visual update" 

on a 60Hz monitor it would be 60fps on a 100Hz monitor it would be 100fps

the MDN documentation is not correct: 

> method tells the browser that you wish to perform an animation and requests that the browser call a specified function to update an animation before the next repaint.

because it's not just for animation, you're just queueing for the next repaint
the h5ive api:
  var aFrame = h5.animationFrame,
body = document.body,
text, id1, id2, id3;

id1 = aFrame.queue(function(){
    // ...
});
id2 =aFrame.queueAfter(function(){
    // ...
});
the important feature is ​queue​ and ​queueAfter​ that let you queue updates after each other so that the browser will not squash them into just one