Commit c0afa7e6 authored by David Reid's avatar David Reid

Web: Fix a possible JS error.

Public issue https://github.com/mackron/miniaudio/issues/810
parent bde517a1
...@@ -40454,6 +40454,10 @@ static ma_result ma_context_uninit__webaudio(ma_context* pContext) ...@@ -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. */ /* Remove the global miniaudio object from window if there are no more references to it. */
EM_ASM({ EM_ASM({
if (typeof(window.miniaudio) !== 'undefined') { if (typeof(window.miniaudio) !== 'undefined') {
miniaudio.unlock_event_types.map(function(event_type) {
document.removeEventListener(event_type, miniaudio.unlock, true);
});
window.miniaudio.referenceCount -= 1; window.miniaudio.referenceCount -= 1;
if (window.miniaudio.referenceCount === 0) { if (window.miniaudio.referenceCount === 0) {
delete window.miniaudio; delete window.miniaudio;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment