From 2a32abc48a084113fa32604a0dc260b6fd706b22 Mon Sep 17 00:00:00 2001 From: James Stanley Date: Tue, 30 Apr 2024 19:31:12 +0100 Subject: [PATCH] Use closure for renderer loop function --- docs/pages/rendering.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/pages/rendering.md b/docs/pages/rendering.md index 71aca71d..e190bf33 100644 --- a/docs/pages/rendering.md +++ b/docs/pages/rendering.md @@ -38,7 +38,7 @@ class Renderer { } // Game loop - loop(timeStamp) { + loop = (timeStamp) => { if (!this.started) { return; } @@ -65,7 +65,7 @@ class Renderer { } // Request a new frame - window.requestAnimationFrame(this.loop.bind(this)); + window.requestAnimationFrame(this.loop); } renderBody(body) {