update 0.9.0 goodies
This commit is contained in:
parent
d99a5c7185
commit
e401b93e22
11 changed files with 514 additions and 93 deletions
24
sae/prototypes.js
vendored
24
sae/prototypes.js
vendored
|
|
@ -76,3 +76,27 @@ if (!performance.now) {
|
|||
return Date.now() - this.timing.navigationStart;
|
||||
};
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* AnimationFrame */
|
||||
|
||||
(function() {
|
||||
var lastTime = 0;
|
||||
|
||||
if (!window.requestAnimationFrame) {
|
||||
console.warn("This browser does not support 'window.requestAnimationFrame'. Falling back to 'setTimeout'...");
|
||||
window.requestAnimationFrame = function(callback, element) {
|
||||
var currTime = new Date().getTime();
|
||||
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
|
||||
var id = window.setTimeout(function() { callback(currTime + timeToCall); }, timeToCall);
|
||||
lastTime = currTime + timeToCall;
|
||||
return id;
|
||||
};
|
||||
}
|
||||
if (!window.cancelAnimationFrame) {
|
||||
console.warn("This browser does not support 'window.cancelAnimationFrame'. Falling back to 'clearTimeout'...");
|
||||
window.cancelAnimationFrame = function(id) {
|
||||
clearTimeout(id);
|
||||
};
|
||||
}
|
||||
}());
|
||||
|
|
|
|||
Loading…
Reference in a new issue