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.
34 lines
1.7 KiB
34 lines
1.7 KiB
2 years ago
|
"use strict";
|
||
|
var root_1 = require('./root');
|
||
|
var RequestAnimationFrameDefinition = (function () {
|
||
|
function RequestAnimationFrameDefinition(root) {
|
||
|
if (root.requestAnimationFrame) {
|
||
|
this.cancelAnimationFrame = root.cancelAnimationFrame.bind(root);
|
||
|
this.requestAnimationFrame = root.requestAnimationFrame.bind(root);
|
||
|
}
|
||
|
else if (root.mozRequestAnimationFrame) {
|
||
|
this.cancelAnimationFrame = root.mozCancelAnimationFrame.bind(root);
|
||
|
this.requestAnimationFrame = root.mozRequestAnimationFrame.bind(root);
|
||
|
}
|
||
|
else if (root.webkitRequestAnimationFrame) {
|
||
|
this.cancelAnimationFrame = root.webkitCancelAnimationFrame.bind(root);
|
||
|
this.requestAnimationFrame = root.webkitRequestAnimationFrame.bind(root);
|
||
|
}
|
||
|
else if (root.msRequestAnimationFrame) {
|
||
|
this.cancelAnimationFrame = root.msCancelAnimationFrame.bind(root);
|
||
|
this.requestAnimationFrame = root.msRequestAnimationFrame.bind(root);
|
||
|
}
|
||
|
else if (root.oRequestAnimationFrame) {
|
||
|
this.cancelAnimationFrame = root.oCancelAnimationFrame.bind(root);
|
||
|
this.requestAnimationFrame = root.oRequestAnimationFrame.bind(root);
|
||
|
}
|
||
|
else {
|
||
|
this.cancelAnimationFrame = root.clearTimeout.bind(root);
|
||
|
this.requestAnimationFrame = function (cb) { return root.setTimeout(cb, 1000 / 60); };
|
||
|
}
|
||
|
}
|
||
|
return RequestAnimationFrameDefinition;
|
||
|
}());
|
||
|
exports.RequestAnimationFrameDefinition = RequestAnimationFrameDefinition;
|
||
|
exports.AnimationFrame = new RequestAnimationFrameDefinition(root_1.root);
|
||
|
//# sourceMappingURL=AnimationFrame.js.map
|