let audioContext; let audioBuffer; chrome.runtime.onMessage.addListener((message, sender, sendResponse) => { if (message.action === 'playSound') { playNotificationSound(); } }); async function playNotificationSound() { if (!audioContext) { audioContext = new AudioContext(); const response = await fetch(chrome.runtime.getURL('notify.wav')); const arrayBuffer = await response.arrayBuffer(); audioBuffer = await audioContext.decodeAudioData(arrayBuffer); } const source = audioContext.createBufferSource(); source.buffer = audioBuffer; source.connect(audioContext.destination); source.start(0); }