Add Teardown code
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
Chaoscaot 2024-03-06 16:58:41 +01:00
Ursprung 7c473d3545
Commit 8a7c8597da

Datei anzeigen

@ -37,6 +37,7 @@
let renderer: THREE.WebGLRenderer; let renderer: THREE.WebGLRenderer;
let controls: OrbitControls; let controls: OrbitControls;
let light: THREE.AmbientLight; let light: THREE.AmbientLight;
let observer: ResizeObserver;
onMount(() => { onMount(() => {
scene = new THREE.Scene(); scene = new THREE.Scene();
@ -70,7 +71,8 @@
light = new THREE.AmbientLight(0xffffff, 1); light = new THREE.AmbientLight(0xffffff, 1);
scene.add(light); scene.add(light);
new ResizeObserver(handleResize).observe(div); observer = new ResizeObserver(handleResize);
observer.observe(div);
loaded = true; loaded = true;
@ -91,6 +93,9 @@
if (loaded) { if (loaded) {
loaded = false; loaded = false;
observer.unobserve(div);
observer.disconnect();
renderer.dispose(); renderer.dispose();
scene.clear(); scene.clear();
light.dispose(); light.dispose();