@@ -5,22 +5,22 @@ export class RequestAnimationFrameDefinition {
5
5
requestAnimationFrame : ( cb : ( ) => void ) => number ;
6
6
constructor ( root : any ) {
7
7
if ( root . requestAnimationFrame ) {
8
- this . cancelAnimationFrame = root . cancelAnimationFrame ;
9
- this . requestAnimationFrame = root . requestAnimationFrame ;
8
+ this . cancelAnimationFrame = root . cancelAnimationFrame . bind ( root ) ;
9
+ this . requestAnimationFrame = root . requestAnimationFrame . bind ( root ) ;
10
10
} else if ( root . mozRequestAnimationFrame ) {
11
- this . cancelAnimationFrame = root . mozCancelAnimationFrame ;
12
- this . requestAnimationFrame = root . mozRequestAnimationFrame ;
11
+ this . cancelAnimationFrame = root . mozCancelAnimationFrame . bind ( root ) ;
12
+ this . requestAnimationFrame = root . mozRequestAnimationFrame . bind ( root ) ;
13
13
} else if ( root . webkitRequestAnimationFrame ) {
14
- this . cancelAnimationFrame = root . webkitCancelAnimationFrame ;
15
- this . requestAnimationFrame = root . webkitRequestAnimationFrame ;
14
+ this . cancelAnimationFrame = root . webkitCancelAnimationFrame . bind ( root ) ;
15
+ this . requestAnimationFrame = root . webkitRequestAnimationFrame . bind ( root ) ;
16
16
} else if ( root . msRequestAnimationFrame ) {
17
- this . cancelAnimationFrame = root . msCancelAnimationFrame ;
18
- this . requestAnimationFrame = root . msRequestAnimationFrame ;
17
+ this . cancelAnimationFrame = root . msCancelAnimationFrame . bind ( root ) ;
18
+ this . requestAnimationFrame = root . msRequestAnimationFrame . bind ( root ) ;
19
19
} else if ( root . oRequestAnimationFrame ) {
20
- this . cancelAnimationFrame = root . oCancelAnimationFrame ;
21
- this . requestAnimationFrame = root . oRequestAnimationFrame ;
20
+ this . cancelAnimationFrame = root . oCancelAnimationFrame . bind ( root ) ;
21
+ this . requestAnimationFrame = root . oRequestAnimationFrame . bind ( root ) ;
22
22
} else {
23
- this . cancelAnimationFrame = root . clearTimeout ;
23
+ this . cancelAnimationFrame = root . clearTimeout . bind ( root ) ;
24
24
this . requestAnimationFrame = function ( cb ) { return root . setTimeout ( cb , 1000 / 60 ) ; } ;
25
25
}
26
26
}
0 commit comments