aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-05-12 19:10:04 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-05-12 19:10:04 -0700
commit9b5c6ba745f847fdfb57e6606508ed0d58b6633d (patch)
treefeb1792392715bbbc7b55ac16796d7a1e0a95192
parent15d0f8bf3db70eaf915f1af0b205d751c9edceaa (diff)
show Running... when calling run()
-rw-r--r--src/postamble.js42
-rw-r--r--src/shell.html2
2 files changed, 25 insertions, 19 deletions
diff --git a/src/postamble.js b/src/postamble.js
index 7a9785c8..263db773 100644
--- a/src/postamble.js
+++ b/src/postamble.js
@@ -41,29 +41,35 @@ function run(args) {
}
}
+ function doRun() {
+ var ret = 0;
+ if (Module['_main']) {
+ preMain();
+ ret = Module.callMain(args);
+ if (!Module['noExitRuntime']) {
+ exitRuntime();
+ }
+ }
+ if (Module['postRun']) {
+ Module['postRun']();
+ }
+ return ret;
+ }
+
+#if GENERATING_HTML
if (Module['setStatus']) {
Module['setStatus']('Running...');
-#if GENERATING_HTML
setTimeout(function() {
- Module['setStatus'](''); // clear 'Running...' after first frame
+ doRun();
+ Module['setStatus']('');
}, 1);
-#endif
+ return 0;
+ } else {
+ return doRun();
}
-
- var ret = null;
- if (Module['_main']) {
- preMain();
- ret = Module.callMain(args);
- if (!Module['noExitRuntime']) {
- exitRuntime();
- }
- }
-
- if (Module['postRun']) {
- Module['postRun']();
- }
-
- return ret;
+#else
+ return doRun();
+#endif
}
Module['run'] = run;
diff --git a/src/shell.html b/src/shell.html
index 035cd5ef..404c9c11 100644
--- a/src/shell.html
+++ b/src/shell.html
@@ -39,7 +39,7 @@
canvas: document.getElementById('canvas'),
setStatus: function(text) {
if (Module.setStatus.interval) clearInterval(Module.setStatus.interval);
- document.getElementById('status').innerHTML = '';
+ document.getElementById('status').innerHTML = text;
if (text) {
var counter = 0;
Module.setStatus.interval = setInterval(function() {