Web: Fix a possible JS error.

Public issue https://github.com/mackron/miniaudio/issues/810
This commit is contained in:
David Reid
2024-01-28 08:46:56 +10:00
parent bde517a166
commit c0afa7e621
+4
View File
@@ -40454,6 +40454,10 @@ static ma_result ma_context_uninit__webaudio(ma_context* pContext)
/* Remove the global miniaudio object from window if there are no more references to it. */
EM_ASM({
if (typeof(window.miniaudio) !== 'undefined') {
miniaudio.unlock_event_types.map(function(event_type) {
document.removeEventListener(event_type, miniaudio.unlock, true);
});
window.miniaudio.referenceCount -= 1;
if (window.miniaudio.referenceCount === 0) {
delete window.miniaudio;