Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified js/borg-stmf/dist/stmf.wasm
Binary file not shown.
25 changes: 19 additions & 6 deletions js/borg-stmf/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down
Binary file modified js/borg-stmf/stmf.wasm
Binary file not shown.
5 changes: 1 addition & 4 deletions pkg/player/assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down