diff options
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; |