From 62f82b46c9c9456bff8807d67dd879f44369c86b Mon Sep 17 00:00:00 2001 From: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Sun, 1 Dec 2024 11:14:45 +0900 Subject: [PATCH] =?UTF-8?q?fix(frontend):=20=E7=94=BB=E9=9D=A2=E3=82=92?= =?UTF-8?q?=E9=96=89=E3=81=98=E3=82=8B=E7=9B=B4=E5=89=8D=E3=81=ABAudioCont?= =?UTF-8?q?ext=E3=82=92=E9=96=89=E3=81=98=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/frontend/src/scripts/sound.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/frontend/src/scripts/sound.ts b/packages/frontend/src/scripts/sound.ts index 05f82fce7d..2008afe045 100644 --- a/packages/frontend/src/scripts/sound.ts +++ b/packages/frontend/src/scripts/sound.ts @@ -93,6 +93,10 @@ export async function loadAudio(url: string, options?: { useCache?: boolean; }) // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition if (ctx == null) { ctx = new AudioContext(); + + window.addEventListener('beforeunload', () => { + ctx.close(); + }); } if (options?.useCache ?? true) { if (cache.has(url)) {