aboutsummaryrefslogtreecommitdiff
path: root/src/postamble.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/postamble.js')
-rw-r--r--src/postamble.js21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/postamble.js b/src/postamble.js
index ea03391c..10ac1888 100644
--- a/src/postamble.js
+++ b/src/postamble.js
@@ -33,11 +33,13 @@ function run(args) {
args = args || Module['arguments'];
if (Module['preRun']) {
- Module['preRun']();
- if (runDependencies > 0) {
- // preRun added a dependency, run will be called later
- Module['preRun'] = null;
- return 0;
+ if (typeof Module['preRun'] == 'function') Module['preRun'] = [Module['preRun']];
+ while (Module['preRun'].length > 0) {
+ Module['preRun'].pop()();
+ if (runDependencies > 0) {
+ // preRun added a dependency, run will be called later
+ return 0;
+ }
}
}
@@ -51,12 +53,14 @@ function run(args) {
}
}
if (Module['postRun']) {
- Module['postRun']();
+ if (typeof Module['postRun'] == 'function') Module['postRun'] = [Module['postRun']];
+ while (Module['postRun'].length > 0) {
+ Module['postRun'].pop()();
+ }
}
return ret;
}
-#if GENERATING_HTML
if (Module['setStatus']) {
Module['setStatus']('Running...');
setTimeout(function() {
@@ -69,9 +73,6 @@ function run(args) {
} else {
return doRun();
}
-#else
- return doRun();
-#endif
}
Module['run'] = run;