aboutsummaryrefslogtreecommitdiff
path: root/src/library_browser.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-10-13 10:06:33 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-10-13 10:06:33 -0700
commit45ba35aa01f1650ed28479976262236bbf204ef1 (patch)
treea45ef1240a00776b9fd0b0b9b1a89b877848b474 /src/library_browser.js
parent3a156a34e83fa301b8abbac6effdb5bd21d9be11 (diff)
add parameter to emscripten_set_main_loop to optionally simulate an infinite loop by throwing an exception (like glutMainLoop)
Diffstat (limited to 'src/library_browser.js')
-rw-r--r--src/library_browser.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/library_browser.js b/src/library_browser.js
index 6985e04a..fc8cb84c 100644
--- a/src/library_browser.js
+++ b/src/library_browser.js
@@ -402,7 +402,7 @@ mergeInto(LibraryManager.library, {
}, millis);
},
- emscripten_set_main_loop: function(func, fps) {
+ emscripten_set_main_loop: function(func, fps, simulateInfiniteLoop) {
Module['noExitRuntime'] = true;
var jsFunc = FUNCTION_TABLE[func];
@@ -462,6 +462,10 @@ mergeInto(LibraryManager.library, {
}
}
Browser.mainLoop.scheduler();
+
+ if (simulateInfiniteLoop) {
+ throw 'emscripten_set_main_loop simulating infinite loop by throwing so we get right into the JS event loop';
+ }
},
emscripten_cancel_main_loop: function() {