You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
697 B

/**
* mui fixed requestAnimationFrame
* @param {type} window
* @returns {undefined}
*/
(function(window) {
if (!window.requestAnimationFrame) {
var lastTime = 0;
window.requestAnimationFrame = window.webkitRequestAnimationFrame || function(callback, element) {
var currTime = new Date().getTime();
var timeToCall = Math.max(0, 16.7 - (currTime - lastTime));
var id = window.setTimeout(function() {
callback(currTime + timeToCall);
}, timeToCall);
lastTime = currTime + timeToCall;
return id;
};
window.cancelAnimationFrame = window.webkitCancelAnimationFrame || window.webkitCancelRequestAnimationFrame || function(id) {
clearTimeout(id);
};
};
}(window));