aboutsummaryrefslogtreecommitdiff
path: root/src/postamble.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/postamble.js')
-rw-r--r--src/postamble.js35
1 files changed, 23 insertions, 12 deletions
diff --git a/src/postamble.js b/src/postamble.js
index 390f9f27..cf863669 100644
--- a/src/postamble.js
+++ b/src/postamble.js
@@ -32,38 +32,49 @@ Module.callMain = function callMain(args) {
function run(args) {
args = args || Module['arguments'];
- initRuntime();
+ if (Module['setStatus']) {
+ Module['setStatus'](''); // clear the status from "Downloading.." etc.
+ }
+
+ if (Module['preRun']) {
+ Module['preRun']();
+ }
var ret = null;
if (Module['_main']) {
+ preMain();
ret = Module.callMain(args);
- exitRuntime();
+ if (!Module['noExitRuntime']) {
+ exitRuntime();
+ }
+ }
+
+ if (Module['postRun']) {
+ Module['postRun']();
}
+
return ret;
}
Module['run'] = run;
// {{PRE_RUN_ADDITIONS}}
-if (Module['preRun']) {
- Module['preRun']();
-}
+initRuntime();
#if INVOKE_RUN
#else
-Module['noInitialRun'] = true;
+addRunDependency();
#endif
+if (Module['noInitialRun']) {
+ addRunDependency();
+}
-if (!Module['noInitialRun']) {
+if (runDependencies == 0) {
var ret = run();
#if CATCH_EXIT_CODE
- print('Exit Status: ' + ret);
+ Module.print('Exit Status: ' + ret);
#endif
}
// {{POST_RUN_ADDITIONS}}
-if (Module['postRun']) {
- Module['postRun']();
-}
-