summaryrefslogtreecommitdiff
path: root/packages/frontend/src/scripts
diff options
context:
space:
mode:
authorかっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>2025-01-26 15:07:12 +0900
committerGitHub <noreply@github.com>2025-01-26 06:07:12 +0000
commit791b4500ec405446785acdc6d10c41acd9d2583c (patch)
tree7c20283f83ff6edab171db5c8b549ae60d27a472 /packages/frontend/src/scripts
parentfix(backend): ノートの閲覧にログイン必須にしてもFeedでノ... (diff)
downloadsharkey-791b4500ec405446785acdc6d10c41acd9d2583c.tar.gz
sharkey-791b4500ec405446785acdc6d10c41acd9d2583c.tar.bz2
sharkey-791b4500ec405446785acdc6d10c41acd9d2583c.zip
fix(frontend): 画面を閉じる直前にAudioContextを閉じるように (#15080)
* fix(frontend): 画面を閉じる直前にAudioContextを閉じるように * Update Changelog * Update CHANGELOG.md --------- Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
Diffstat (limited to 'packages/frontend/src/scripts')
-rw-r--r--packages/frontend/src/scripts/sound.ts4
1 files changed, 4 insertions, 0 deletions
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)) {