Skip to content

Commit 82834df

Browse files
committed
Made animframe_polyfill.js JSHint compliant
Reformatted a bunch to make JSHint happy.
1 parent 878098f commit 82834df

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

js/animframe_polyfill.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
1-
(function() {
1+
(function () {
22
var lastTime = 0;
33
var vendors = ['webkit', 'moz'];
4-
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
5-
window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
6-
window.cancelAnimationFrame =
7-
window[vendors[x]+'CancelAnimationFrame'] || window[vendors[x]+'CancelRequestAnimationFrame'];
4+
for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
5+
window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];
6+
window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] ||
7+
window[vendors[x] + 'CancelRequestAnimationFrame'];
88
}
99

1010
if (!window.requestAnimationFrame) {
11-
window.requestAnimationFrame = function(callback, element) {
11+
window.requestAnimationFrame = function (callback) {
1212
var currTime = new Date().getTime();
1313
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
14-
var id = window.setTimeout(function() { callback(currTime + timeToCall); },
14+
var id = window.setTimeout(function () {
15+
callback(currTime + timeToCall);
16+
},
1517
timeToCall);
1618
lastTime = currTime + timeToCall;
1719
return id;
1820
};
1921
}
2022

2123
if (!window.cancelAnimationFrame) {
22-
window.cancelAnimationFrame = function(id) {
24+
window.cancelAnimationFrame = function (id) {
2325
clearTimeout(id);
2426
};
2527
}

0 commit comments

Comments
 (0)