From 01e5a5c7e84b19279bfb2656406ad94f9ca0bc0b Mon Sep 17 00:00:00 2001 From: Reimar Date: Wed, 15 Oct 2025 09:48:22 +0200 Subject: [PATCH] fix browser events in export html --- src/html_exporter.js | 5 ++++- src/utils.js | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/html_exporter.js b/src/html_exporter.js index a1eab74..f4ff3f6 100644 --- a/src/html_exporter.js +++ b/src/html_exporter.js @@ -52,6 +52,8 @@ export class HtmlExporter { const gamelib = new Gamelib(console, new AssetProvider(), document.querySelector('canvas')); + gamelib.init(); + window.karlkoder = { lib() { return gamelib.getAdapter(); @@ -65,7 +67,8 @@ ${js} -`; + + `.trim(); return html; } diff --git a/src/utils.js b/src/utils.js index 0141a88..85ed80f 100644 --- a/src/utils.js +++ b/src/utils.js @@ -28,7 +28,7 @@ export function minifyJs(code) { .map((line) => line .replace(/\/\/.+$/, "") - .replace(/\) \{/, "){") + .replace(/\) \{\n/, "){") .replace(/ = /g, "=") .trim() )