File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -92,16 +92,19 @@ var RequestAnimationFrame = new Class({
9292 * @type {FrameRequestCallback }
9393 * @since 3.0.0
9494 */
95- this . step = function step ( timestamp )
95+ this . step = function step ( )
9696 {
97+ // Because we cannot trust the time passed to this callback from the browser and need it kept in sync with event times
98+ var timestamp = window . performance . now ( ) ;
99+
97100 // DOMHighResTimeStamp
98101 _this . lastTime = _this . tick ;
99102
100103 _this . tick = timestamp ;
101104
102- _this . timeOutID = window . requestAnimationFrame ( step ) ;
103-
104105 _this . callback ( timestamp ) ;
106+
107+ _this . timeOutID = window . requestAnimationFrame ( step ) ;
105108 } ;
106109
107110 /**
@@ -122,9 +125,9 @@ var RequestAnimationFrame = new Class({
122125
123126 _this . tick = d ;
124127
125- _this . timeOutID = window . setTimeout ( stepTimeout , delay ) ;
126-
127128 _this . callback ( d ) ;
129+
130+ _this . timeOutID = window . setTimeout ( stepTimeout , delay ) ;
128131 } ;
129132 } ,
130133
You can’t perform that action at this time.
0 commit comments