|
The setInterval timing is not consistent across browsers.
Hi, I'm finding that the he elapsed number which is determined by the setInterval function is not consistent across browsers. The value can vary considerably. Can anyone advise on a way to get it more uniform.
update(elapsed: number) { var elapsedUnit = elapsed / 10;
this code is called based on this setInterval code :
$(document).ready(function () {
var game: Game = new Game;
$(document).keydown(game.onKeyDown);
$(document).keyup(game.onKeyUp);
//game.update();
//game.draw();
var timeA = new Date().getTime();
setInterval(function () {
var timeB = new Date().getTime();
var elapsedTime = timeB - timeA
game.update(elapsedTime);
game.draw();
}, 1000 / this.FPS);
});
__________________
|