aboutsummaryrefslogtreecommitdiff
path: root/system/include/emscripten.h
diff options
context:
space:
mode:
Diffstat (limited to 'system/include/emscripten.h')
-rw-r--r--system/include/emscripten.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/system/include/emscripten.h b/system/include/emscripten.h
index ea078e8c..7bb2ae8e 100644
--- a/system/include/emscripten.h
+++ b/system/include/emscripten.h
@@ -28,6 +28,21 @@ extern void emscripten_set_main_loop(void (*func)(), int fps);
extern void emscripten_cancel_main_loop();
/*
+ * Call a C function asynchronously, that is, after returning
+ * control to the JS event loop. This is done by a setTimeout.
+ * When building natively this becomes a simple direct call,
+ * after SDL_Delay (you must include SDL.h for that).
+ */
+#if EMSCRIPTEN
+extern void emscripten_async_call(void (*func)(), int millis);
+#else
+void emscripten_async_call(void (*func)(), int millis) {
+ SDL_Delay(millis);
+ func();
+}
+#endif
+
+/*
* This macro-looking function will cause Emscripten to
* generate a comment in the generated code.
* XXX This is deprecated for now, because it requires us to