This commit is contained in:
Snider 2026-02-13 22:14:32 +00:00 committed by GitHub
commit 1591523c93
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 20 additions and 10 deletions

Binary file not shown.

View file

@ -306,13 +306,26 @@ export class BorgSTMF {
}
private async waitForWasm(timeout = 5000): Promise<void> {
const start = Date.now();
while (!window.BorgSTMF?.ready) {
if (Date.now() - start > timeout) {
throw new Error('Timeout waiting for WASM module to initialize');
}
await new Promise((resolve) => setTimeout(resolve, 50));
if (window.BorgSTMF?.ready) {
return;
}
return new Promise((resolve, reject) => {
let timeoutId: number;
const onReady = () => {
window.clearTimeout(timeoutId);
document.removeEventListener('borgstmf:ready', onReady);
resolve();
};
timeoutId = window.setTimeout(() => {
document.removeEventListener('borgstmf:ready', onReady);
reject(new Error('Timeout waiting for WASM module to initialize'));
}, timeout);
document.addEventListener('borgstmf:ready', onReady, { once: true });
});
}
private async loadScript(src: string): Promise<void> {

Binary file not shown.

View file

@ -8,10 +8,7 @@ import (
// Assets embeds all frontend files for the media player
// These are served both by Wails (memory) and HTTP (fallback)
//
//go:embed frontend/index.html
//go:embed frontend/wasm_exec.js
//go:embed frontend/stmf.wasm
//go:embed frontend/demo-track.smsg
//go:embed frontend
var assets embed.FS
// Assets returns the embedded filesystem with frontend/ prefix stripped