diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-03-15 14:07:04 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-03-15 14:07:04 -0700 |
commit | be1631232551386af02b424eb40d236215696e4a (patch) | |
tree | cd61496f94065e20f9ae92f5850a54f458bc6ffa /src/preamble.js | |
parent | 38b121aff6b48f724023d837fd164836c3f7fb69 (diff) |
add file preloading in browsers
Diffstat (limited to 'src/preamble.js')
-rw-r--r-- | src/preamble.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/preamble.js b/src/preamble.js index afae5ea7..ae7bd660 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -873,5 +873,18 @@ var STRING_TABLE = []; {{{ unSign }}} {{{ reSign }}} +// A counter of dependencies for calling run(). If we need to +// do asynchronous work before running, increment this and +// decrement it. Incrementing must happen in Module.preRun +// or PRE_RUN_ADDITIONS (used by emcc to add file preloading). +var runDependencies = 0; +function addRunDependency() { + runDependencies++; +} +function removeRunDependency() { + runDependencies--; + if (runDependencies == 0) run(); +} + // === Body === |