@@ -5,22 +5,22 @@ export class RequestAnimationFrameDefinition {
55 requestAnimationFrame : ( cb : ( ) => void ) => number ;
66 constructor ( root : any ) {
77 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 ) ;
1010 } 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 ) ;
1313 } 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 ) ;
1616 } 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 ) ;
1919 } 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 ) ;
2222 } else {
23- this . cancelAnimationFrame = root . clearTimeout ;
23+ this . cancelAnimationFrame = root . clearTimeout . bind ( root ) ;
2424 this . requestAnimationFrame = function ( cb ) { return root . setTimeout ( cb , 1000 / 60 ) ; } ;
2525 }
2626 }
0 commit comments