refac: code block
Some checks are pending
Deploy to HuggingFace Spaces / check-secret (push) Waiting to run
Deploy to HuggingFace Spaces / deploy (push) Blocked by required conditions
Create and publish Docker images with specific build args / build-main-image (linux/amd64) (push) Waiting to run
Create and publish Docker images with specific build args / build-main-image (linux/arm64) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda-image (linux/amd64) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda-image (linux/arm64) (push) Waiting to run
Create and publish Docker images with specific build args / build-ollama-image (linux/amd64) (push) Waiting to run
Create and publish Docker images with specific build args / build-ollama-image (linux/arm64) (push) Waiting to run
Create and publish Docker images with specific build args / merge-main-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-cuda-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-ollama-images (push) Blocked by required conditions
Python CI / Format Backend (3.11) (push) Waiting to run
Frontend Build / Format & Build Frontend (push) Waiting to run
Frontend Build / Frontend Unit Tests (push) Waiting to run

This commit is contained in:
Timothy Jaeryang Baek 2025-02-09 22:43:32 -08:00
parent 60095598ec
commit a22d1d5410

View File

@ -5,7 +5,14 @@
import { v4 as uuidv4 } from 'uuid';
import { getContext, getAllContexts, onMount, tick, createEventDispatcher } from 'svelte';
import {
getContext,
getAllContexts,
onMount,
tick,
createEventDispatcher,
onDestroy
} from 'svelte';
import { copyToClipboard } from '$lib/utils';
import 'highlight.js/styles/github-dark.min.css';
@ -31,6 +38,8 @@
export let editorClassName = '';
export let stickyButtonsClassName = 'top-8';
let pyodideWorker = null;
let _code = '';
$: if (code) {
updateCode();
@ -138,7 +147,7 @@
console.log(packages);
const pyodideWorker = new PyodideWorker();
pyodideWorker = new PyodideWorker();
pyodideWorker.postMessage({
id: id,
@ -280,6 +289,12 @@
});
}
});
onDestroy(() => {
if (pyodideWorker) {
pyodideWorker.terminate();
}
});
</script>
<div>