aboutsummaryrefslogtreecommitdiff
path: root/src/preamble.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-03-15 14:07:04 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-03-15 14:07:04 -0700
commitbe1631232551386af02b424eb40d236215696e4a (patch)
treecd61496f94065e20f9ae92f5850a54f458bc6ffa /src/preamble.js
parent38b121aff6b48f724023d837fd164836c3f7fb69 (diff)
add file preloading in browsers
Diffstat (limited to 'src/preamble.js')
-rw-r--r--src/preamble.js13
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 ===