use requestAnimationFrame to allow new browsers to schedule renders
for better performance
This commit is contained in:
parent
648888a01e
commit
db1c016b12
1 changed files with 10 additions and 1 deletions
|
|
@ -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";
|
this.messageName = "zero-timeout-message";
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue