refactored many events to use wails bindings, reducing boilerplate

This commit is contained in:
2026-02-25 18:51:07 -05:00
parent baa4644ece
commit cf144bf0dd
20 changed files with 1044 additions and 716 deletions
+7 -10
View File
@@ -1,5 +1,6 @@
import { EventsOn, EventsEmit } from '@runtime/runtime';
import { EventsOn } from '@runtime/runtime';
import { Events } from '../events';
import * as Player from '@go/player/Player';
// TrackInfo mirrors the player.TrackInfo struct in the Go backend.
// Fields are serialized as camelCase JSON via struct tags.
@@ -79,27 +80,23 @@ class PlayerStore {
// ===================================================================
// ACTIONS
// These delegate to the backend via Wails events
// These delegate to the backend via Wails bindings
// ===================================================================
play(): void {
EventsEmit(Events.RequestPlay);
}
pause(): void {
EventsEmit(Events.RequestPause);
Player.Pause();
}
loadTrack(filePath: string): void {
EventsEmit(Events.RequestLoadFile, filePath);
Player.LoadFile(filePath);
}
seek(seconds: number): void {
EventsEmit(Events.Seek, seconds);
Player.Seek(seconds);
}
setVolume(level: number): void {
EventsEmit(Events.RequestSetVolume, level);
Player.SetVolume(level);
}
// ===================================================================