mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2026-11-18 07:27:43 +00:00
progress
This commit is contained in:
1 parent
27c0a57cc1
commit
41dc853f65
6 files changed
+59
-27
No files matched your search
@@ -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