aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/library_browser.js11
-rw-r--r--src/library_sdl.js4
-rw-r--r--src/runtime.js11
3 files changed, 14 insertions, 12 deletions
diff --git a/src/library_browser.js b/src/library_browser.js
index cb9a40cf..b2ec0869 100644
--- a/src/library_browser.js
+++ b/src/library_browser.js
@@ -5,7 +5,6 @@
mergeInto(LibraryManager.library, {
$Browser: {
pointerLock: false,
- asyncCalls: {},
createContext: function(canvas, useWebGL) {
#if !USE_TYPED_ARRAYS
@@ -128,14 +127,6 @@ mergeInto(LibraryManager.library, {
0; // delta;
},
- getAsyncCall: function(func) {
- if (!Browser.asyncCalls[func]) {
- Browser.asyncCalls[func] = function() {
- FUNCTION_TABLE[func].apply(null, arguments);
- };
- }
- return Browser.asyncCalls[func];
- }
},
emscripten_async_run_script__deps: ['emscripten_run_script'],
@@ -178,7 +169,7 @@ mergeInto(LibraryManager.library, {
emscripten_async_call: function(func, millis) {
Module['noExitRuntime'] = true;
- var asyncCall = Browser.getAsyncCall(func);
+ var asyncCall = Runtime.getFuncWrapper(func);
if (millis >= 0) {
setTimeout(asyncCall, millis);
} else {
diff --git a/src/library_sdl.js b/src/library_sdl.js
index a23a9d21..7a1619ff 100644
--- a/src/library_sdl.js
+++ b/src/library_sdl.js
@@ -918,7 +918,7 @@ var LibrarySDL = {
info.audio = audio.cloneNode(true);
if (SDL.channelFinished) {
info.audio['onended'] = function() { // TODO: cache these
- Browser.getAsyncCall(SDL.channelFinished)(channel);
+ Runtime.getFuncWrapper(SDL.channelFinished)(channel);
}
}
info.audio.play();
@@ -938,7 +938,7 @@ var LibrarySDL = {
info.audio = null;
}
if (SDL.channelFinished) {
- Browser.getAsyncCall(SDL.channelFinished)(channel);
+ Runtime.getFuncWrapper(SDL.channelFinished)(channel);
}
return 0;
},
diff --git a/src/runtime.js b/src/runtime.js
index 51fbbdb3..6a251c46 100644
--- a/src/runtime.js
+++ b/src/runtime.js
@@ -323,6 +323,17 @@ var Runtime = {
}
},
+ funcWrappers: {},
+
+ getFuncWrapper: function(func) {
+ if (!Runtime.funcWrappers[func]) {
+ Runtime.funcWrappers[func] = function() {
+ FUNCTION_TABLE[func].apply(null, arguments);
+ };
+ }
+ return Runtime.funcWrappers[func];
+ },
+
#if RUNTIME_DEBUG
debug: true, // Switch to false at runtime to disable logging at the right times