Implement monitoring infrastructure
This commit is contained in:
24
frontend/src/pages/playground/Canvas.svelte
Normal file
24
frontend/src/pages/playground/Canvas.svelte
Normal file
@@ -0,0 +1,24 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from "svelte";
|
||||
|
||||
export let color: string;
|
||||
|
||||
let canvas: HTMLCanvasElement;
|
||||
|
||||
let redraws = 0;
|
||||
|
||||
function redraw(color) {
|
||||
if (!canvas) return;
|
||||
|
||||
redraws += 1;
|
||||
let cx = canvas.getContext("2d");
|
||||
cx.fillStyle = color;
|
||||
cx.fillRect(0, 0, cx.canvas.width, cx.canvas.height);
|
||||
}
|
||||
|
||||
$: redraw(color);
|
||||
</script>
|
||||
|
||||
<canvas bind:this={canvas} />
|
||||
<pre>color: {color}
|
||||
redraws: {redraws}</pre>
|
||||
Reference in New Issue
Block a user