Skip to content

Commit

Permalink
[AUDIO_WORKLET] Avoid direct reference to clearTimeout (#23287)
Browse files Browse the repository at this point in the history
Fixes: #23286
  • Loading branch information
sbc100 authored Jan 3, 2025
1 parent 5e3ed77 commit ff146f3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/library_eventloop.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,13 @@ LibraryJSEventLoop = {
emscripten_set_timeout: (cb, msecs, userData) =>
safeSetTimeout(() => {{{ makeDynCall('vp', 'cb') }}}(userData), msecs),

#if AUDIO_WORKLET
// Use a wrapper function here since simply aliasing `clearTimeout` would
// cause the module to fail to load in the audio worklet context.
emscripten_clear_timeout: (id) => clearTimeout(id),
#else
emscripten_clear_timeout: 'clearTimeout',
#endif

emscripten_set_timeout_loop__deps: ['$callUserCallback', 'emscripten_get_now'],
emscripten_set_timeout_loop: (cb, msecs, userData) => {
Expand Down

0 comments on commit ff146f3

Please sign in to comment.