From e2d9aa60b4af54afd6e4f5d1790380ecf8f272f1 Mon Sep 17 00:00:00 2001 From: lordlogo2002 Date: Sun, 20 Jul 2025 15:18:12 +0200 Subject: [PATCH] fix: update refs handling in RickGamePanel for improved canvas access --- source/src/index.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/src/index.tsx b/source/src/index.tsx index 6861923..e5e178d 100644 --- a/source/src/index.tsx +++ b/source/src/index.tsx @@ -1,6 +1,7 @@ import { h, render, Component } from 'nano-jsx' class RickGamePanel extends Component { + refs: { [key: string]: any } = {} canvas?: HTMLCanvasElement ctx?: CanvasRenderingContext2D x = 20 @@ -59,13 +60,14 @@ class RickGamePanel extends Component { } mounted() { - this.canvas = this.ref('game') as HTMLCanvasElement + this.canvas = this.refs['game'] as HTMLCanvasElement this.ctx = this.canvas?.getContext('2d') || undefined this.canvas?.addEventListener('click', this.handleJump) this.frame() } + render() { return (