File tree Expand file tree Collapse file tree 4 files changed +12
-1
lines changed
Expand file tree Collapse file tree 4 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -309,6 +309,7 @@ $effect(() => {
309309
310310onDestroy (() => {
311311 stopWorldUpdates ();
312+ SimulationService .destroy ();
312313 if (app .canvas ) {
313314 app .destroy (true );
314315 }
Original file line number Diff line number Diff line change @@ -41,6 +41,14 @@ class SimulationService {
4141
4242 return this . wasmSimulation . get_world_state ( ) ;
4343 } ;
44+
45+ destroy = ( ) => {
46+ if ( ! this . wasmSimulation ) {
47+ return ;
48+ }
49+ this . wasmSimulation . free ( ) ;
50+ this . wasmSimulation = null ;
51+ } ;
4452}
4553
4654export default new SimulationService ( ) ;
Original file line number Diff line number Diff line change @@ -43,5 +43,7 @@ export const stopWorldUpdates = () => {
4343 if ( animationFrameId ) {
4444 cancelAnimationFrame ( animationFrameId ) ;
4545 animationFrameId = null ;
46+ worldStore . set ( null ) ;
47+ statsStore . set ( null ) ;
4648 }
4749} ;
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ onMount(async () => {
1212 // Show connecting screen for fun
1313 setTimeout (() => {
1414 isLoading = false ;
15- }, 2000 );
15+ }, 1000 );
1616});
1717 </script >
1818
You can’t perform that action at this time.
0 commit comments