refacto : cleaning the codebasebase again

This commit is contained in:
Tom Boullay
2026-04-19 16:50:11 +02:00
parent f9c4495610
commit dcbc1c73f5
26 changed files with 127 additions and 5726 deletions
+13 -3
View File
@@ -3,6 +3,10 @@ export class AudioManager {
private readonly _audioPools = new Map<string, HTMLAudioElement[]>();
private static readonly MAX_POOL_SIZE_PER_SOUND = 6;
private static readonly IGNORED_PLAYBACK_ERRORS = new Set([
"AbortError",
"NotAllowedError",
]);
static getInstance(): AudioManager {
if (!AudioManager._instance) {
@@ -19,9 +23,15 @@ export class AudioManager {
audio.volume = Math.max(0, Math.min(1, volume));
audio.currentTime = 0;
void audio.play().catch(() => {
audio.pause();
audio.currentTime = 0;
void audio.play().catch((error: unknown) => {
if (
error instanceof DOMException &&
AudioManager.IGNORED_PLAYBACK_ERRORS.has(error.name)
) {
return;
}
console.error(`Failed to play sound: ${path}`, error);
});
}
+4 -13
View File
@@ -1,16 +1,7 @@
export type InteractableKind = "grab" | "trigger";
export interface InteractableHandle {
kind: InteractableKind;
label: string;
onPress: () => void;
onRelease: () => void;
}
export interface InteractionSnapshot {
focused: InteractableHandle | null;
holding: boolean;
}
import type {
InteractableHandle,
InteractionSnapshot,
} from "@/types/interaction";
export class InteractionManager {
private static _instance: InteractionManager | null = null;