mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2026-10-03 12:28:22 +00:00
progress
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
class Engine {
|
||||
_engine: Writable<any>;
|
||||
|
||||
constructor() {
|
||||
this._engine = null;
|
||||
import('gpx-rs').then((wasm) => {
|
||||
this._engine = new wasm.Controller();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
Reference in New Issue
Block a user