use requestAnimationFrame to allow new browsers to schedule renders

for better performance
This commit is contained in:
nightwing 2011-05-14 22:57:50 +05:00
commit db1c016b12

View file

@ -63,7 +63,16 @@ var RenderLoop = function(onRender) {
}
};
if (window.postMessage) {
this.setTimeoutZero = window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame;
if (this.setTimeoutZero) {
this.setTimeoutZero = this.setTimeoutZero.bind(window)
} else if (window.postMessage) {
this.messageName = "zero-timeout-message";