requestAnimationFrame cannot be used in Webkit
since it is not fired when the window is not focused/visible.
This commit is contained in:
parent
e8bfde6e5d
commit
9ab8d986cd
1 changed files with 5 additions and 15 deletions
|
|
@ -61,20 +61,11 @@ var RenderLoop = function(onRender, window) {
|
|||
var changes = _self.changes;
|
||||
_self.changes = 0;
|
||||
_self.onRender(changes);
|
||||
})
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
this.setTimeoutZero = window.requestAnimationFrame ||
|
||||
window.webkitRequestAnimationFrame ||
|
||||
window.mozRequestAnimationFrame ||
|
||||
window.oRequestAnimationFrame ||
|
||||
window.msRequestAnimationFrame;
|
||||
|
||||
if (this.setTimeoutZero) {
|
||||
this.setTimeoutZero = this.setTimeoutZero;
|
||||
} else if (window.postMessage) {
|
||||
|
||||
if (window.postMessage) {
|
||||
this.setTimeoutZero = (function(messageName, attached, listener) {
|
||||
return function setTimeoutZero(callback) {
|
||||
// Set up listener if not listening already.
|
||||
|
|
@ -92,12 +83,11 @@ var RenderLoop = function(onRender, window) {
|
|||
this.postMessage(messageName, "*");
|
||||
};
|
||||
})("zero-timeout-message", false, null);
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
else {
|
||||
this.setTimeoutZero = function(callback) {
|
||||
this.setTimeout(callback, 0);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}).call(RenderLoop.prototype);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue