I have a chain of objects that looks like this:
Game.world.update()
I would like to use requestAnimationFrame to determine the framerate of this function.
However when I implement it like this:
World.prototype.update = function()
{
requestAnimationFrame(this.update);
}
The scope changes from the world object to the window object. How do I maintain the scope I want while calling requestAnimationFrame()? I know it has something to do with anonymous functions and such, but I can't get my head around it.