diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/postamble.js | 5 | ||||
-rw-r--r-- | src/preamble.js | 3 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/postamble.js b/src/postamble.js index cf863669..24b8e4a1 100644 --- a/src/postamble.js +++ b/src/postamble.js @@ -38,6 +38,11 @@ function run(args) { 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; diff --git a/src/preamble.js b/src/preamble.js index e9ba2009..997e5ab3 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -854,6 +854,9 @@ var STRING_TABLE = []; // do asynchronous work before running, increment this and // decrement it. Incrementing must happen in a place like // PRE_RUN_ADDITIONS (used by emcc to add file preloading). +// Note that you can add dependencies in preRun, even though +// it happens right before run - run will be postponed until +// the dependencies are met. var runDependencies = 0; function addRunDependency() { runDependencies++; |