File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change 1
- ( function ( ) {
1
+ ( function ( ) {
2
2
var lastTime = 0 ;
3
3
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' ] ;
8
8
}
9
9
10
10
if ( ! window . requestAnimationFrame ) {
11
- window . requestAnimationFrame = function ( callback , element ) {
11
+ window . requestAnimationFrame = function ( callback ) {
12
12
var currTime = new Date ( ) . getTime ( ) ;
13
13
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
+ } ,
15
17
timeToCall ) ;
16
18
lastTime = currTime + timeToCall ;
17
19
return id ;
18
20
} ;
19
21
}
20
22
21
23
if ( ! window . cancelAnimationFrame ) {
22
- window . cancelAnimationFrame = function ( id ) {
24
+ window . cancelAnimationFrame = function ( id ) {
23
25
clearTimeout ( id ) ;
24
26
} ;
25
27
}
You can’t perform that action at this time.
0 commit comments