fmt + fix deno.jsonc.lib

This commit is contained in:
Theis Pieter Hollebeek 2025-10-10 12:48:16 +02:00
parent e9719acb59
commit 6e641e5d6d
5 changed files with 11 additions and 8 deletions

View File

@ -1,3 +1,4 @@
{
"fmt": { "indentWidth": 4 }
"fmt": { "indentWidth": 4 },
"lib": ["dom", "dom.iterable", "dom.asynciterable", "deno.ns"]
}

View File

@ -14,10 +14,12 @@ export class CodeRunner {
this.console.log("Running code...");
// Stored globally so lib.js can access it
window.libInternalAbortController = new AbortController();
globalThis.libInternalAbortController = new AbortController();
// Use RNG to prevent caching
const encodedText = encodeURIComponent(this.code + `/*(tph): ${Math.random()}*/`);
const encodedText = encodeURIComponent(
this.code + `/*(tph): ${Math.random()}*/`,
);
try {
await import(`data:text/javascript;charset=utf-8,${encodedText}`);
@ -29,7 +31,7 @@ export class CodeRunner {
stop() {
this.isRunning = false;
window.libInternalAbortController?.abort();
globalThis.libInternalAbortController?.abort();
}
toggle() {
@ -37,4 +39,3 @@ export class CodeRunner {
else this.run();
}
}

View File

@ -4,7 +4,9 @@ import { Debounce } from "./debounce.js";
import { PlaygroundConsole } from "./playground-console.js";
import { CodeRunner } from "./code-runner.js";
const playgroundConsole = new PlaygroundConsole(document.querySelector("#console-code"));
const playgroundConsole = new PlaygroundConsole(
document.querySelector("#console-code"),
);
const codeRunner = new CodeRunner(playgroundConsole);
const editor = ace.edit("editor");

View File

@ -40,7 +40,7 @@ export function startGameLoop(loopFunction) {
loopFunction(deltaT);
}, 16);
const abortSignal = window.libInternalAbortController.signal;
const abortSignal = globalThis.libInternalAbortController.signal;
if (abortSignal) {
if (abortSignal.aborted) {
clearInterval(loopInterval);

View File

@ -7,4 +7,3 @@ export class PlaygroundConsole {
this.elem.textContent += `\n${text}\n`;
}
}