Skip to content

Commit

Permalink
Use closure for renderer loop function
Browse files Browse the repository at this point in the history
  • Loading branch information
jes committed Apr 30, 2024
1 parent 5e070f9 commit 2a32abc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/pages/rendering.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Renderer {
}

// Game loop
loop(timeStamp) {
loop = (timeStamp) => {
if (!this.started) {
return;
}
Expand All @@ -65,7 +65,7 @@ class Renderer {
}

// Request a new frame
window.requestAnimationFrame(this.loop.bind(this));
window.requestAnimationFrame(this.loop);
}

renderBody(body) {
Expand Down

0 comments on commit 2a32abc

Please sign in to comment.