diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-05-24 10:13:42 +0200 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-05-24 10:13:42 +0200 |
commit | a6d312ccb942b50287777fc22dc69de926ea3412 (patch) | |
tree | 0acabef2e78a97e7cd1742b9d98acb2a1b496e72 /src/postamble.js | |
parent | c3570e254952ba0593038993674473e900ada9e0 (diff) | |
parent | b7ce870dd4b1352e308e212e77cd6161c1ec904e (diff) |
Merge branch 'master' into llvmsvn
Diffstat (limited to 'src/postamble.js')
-rw-r--r-- | src/postamble.js | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/src/postamble.js b/src/postamble.js index cf863669..ea03391c 100644 --- a/src/postamble.js +++ b/src/postamble.js @@ -32,28 +32,46 @@ Module.callMain = function callMain(args) { function run(args) { args = args || Module['arguments']; - if (Module['setStatus']) { - Module['setStatus'](''); // clear the status from "Downloading.." etc. - } - if (Module['preRun']) { Module['preRun'](); + if (runDependencies > 0) { + // preRun added a dependency, run will be called later + Module['preRun'] = null; + return 0; + } } - var ret = null; - if (Module['_main']) { - preMain(); - ret = Module.callMain(args); - if (!Module['noExitRuntime']) { - exitRuntime(); + 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 (Module['postRun']) { - Module['postRun'](); +#if GENERATING_HTML + if (Module['setStatus']) { + Module['setStatus']('Running...'); + setTimeout(function() { + setTimeout(function() { + Module['setStatus'](''); + }, 1); + doRun(); + }, 1); + return 0; + } else { + return doRun(); } - - return ret; +#else + return doRun(); +#endif } Module['run'] = run; |