This commit is contained in:
vcoppe
2026-09-25 12:09:58 +02:00
parent 27c0a57cc1
commit 41dc853f65
6 changed files with 59 additions and 27 deletions
-10
View File
@@ -1,10 +0,0 @@
class Engine {
_engine: Writable<any>;
constructor() {
this._engine = null;
import('gpx-rs').then((wasm) => {
this._engine = new wasm.Controller();
});
}
}
+22
View File
@@ -0,0 +1,22 @@
import { writable, type Subscriber, type Writable } from 'svelte/store';
class Engine {
_engine: Writable<any>;
constructor() {
this._engine = writable(null);
import('gpx-rs').then((wasm) => {
this._engine.set(new wasm.Engine(this.onUpdate));
});
}
subscribe(run: Subscriber<any>, invalidate?: () => void) {
return this._engine.subscribe(run, invalidate);
}
onUpdate(message: String) {
console.log('message from WASM: ' + message);
}
}
export const engine = new Engine();