diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-07-05 14:58:13 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-07-05 14:58:13 -0700 |
commit | 9aee47c30f90c3d8358a0a8019684a611893b017 (patch) | |
tree | 1ac7b0574f286ae27e89087c0237a3c5595791aa | |
parent | 04bbb220c6472fe8894b4eeffef86b7e6107effd (diff) |
export Browser.pauseMainLoop|resumeMainLoop
-rw-r--r-- | src/library_browser.js | 24 | ||||
-rwxr-xr-x | tests/runner.py | 2 |
2 files changed, 17 insertions, 9 deletions
diff --git a/src/library_browser.js b/src/library_browser.js index 6b32fb43..075bd8bf 100644 --- a/src/library_browser.js +++ b/src/library_browser.js @@ -4,12 +4,24 @@ mergeInto(LibraryManager.library, { $Browser__postset: 'Module["requestFullScreen"] = function() { Browser.requestFullScreen() };\n' + // exports - 'Module["requestAnimationFrame"] = function(func) { Browser.requestAnimationFrame(func) };\n', + 'Module["requestAnimationFrame"] = function(func) { Browser.requestAnimationFrame(func) };\n' + + 'Module["pauseMainLoop"] = function() { Browser.mainLoop.pause() };\n' + + 'Module["resumeMainLoop"] = function() { Browser.mainLoop.resume() };\n', $Browser: { mainLoop: { scheduler: null, shouldPause: false, - paused: false + paused: false, + pause: function() { + Browser.mainLoop.shouldPause = true; + }, + resume: function() { + if (Browser.mainLoop.paused) { + Browser.mainLoop.paused = false; + Browser.mainLoop.scheduler(); + } + Browser.mainLoop.shouldPause = false; + }, }, pointerLock: false, moduleContextCreatedCallbacks: [], @@ -241,15 +253,11 @@ mergeInto(LibraryManager.library, { }, emscripten_pause_main_loop: function(func) { - Browser.mainLoop.shouldPause = true; + Browser.mainLoop.pause(); }, emscripten_resume_main_loop: function(func) { - if (Browser.mainLoop.paused) { - Browser.mainLoop.paused = false; - Browser.mainLoop.scheduler(); - } - Browser.mainLoop.shouldPause = false; + Browser.mainLoop.resume(); }, emscripten_async_call: function(func, millis) { diff --git a/tests/runner.py b/tests/runner.py index 5b005bc4..8bff717d 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -8053,7 +8053,7 @@ elif 'benchmark' in str(sys.argv): '-s', 'INLINING_LIMIT=0', '-s', 'TOTAL_MEMORY=100*1024*1024', '-s', 'FAST_MEMORY=10*1024*1024', '-o', final_filename] + emcc_args, stdout=PIPE, stderr=self.stderr_redirect).communicate() - assert os.path.exists(final_filename), 'Failed to compile file: ' + '\n'.join(output) + assert os.path.exists(final_filename), 'Failed to compile file: ' + output[0] # Run JS global total_times, tests_done |