diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-09-13 14:35:40 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-09-13 14:35:40 -0700 |
commit | 8f3bb14fddb65ef6f47c0ca2b602079eba3bbb44 (patch) | |
tree | 9ccbb54a2ab9f9d4d1d1d78a55c1bf70390bcc56 /src/preamble.js | |
parent | 1c8a94f63981b557026997a7f481d5842de0cf84 (diff) |
refactor code to handle when run dependencies reach 0
Diffstat (limited to 'src/preamble.js')
-rw-r--r-- | src/preamble.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/preamble.js b/src/preamble.js index 2f4e2547..9501f8dc 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -942,8 +942,9 @@ Math.toFloat32 = Math['toFloat32']; // the dependencies are met. var runDependencies = 0; var runDependencyTracking = {}; -var calledRun = false; var runDependencyWatcher = null; +var dependenciesFulfilled = null; // overridden to take different actions when all run dependencies are fulfilled + function addRunDependency(id) { runDependencies++; if (Module['monitorRunDependencies']) { @@ -990,9 +991,8 @@ function removeRunDependency(id) { if (runDependencyWatcher !== null) { clearInterval(runDependencyWatcher); runDependencyWatcher = null; - } - // If run has never been called, and we should call run (INVOKE_RUN is true, and Module.noInitialRun is not false) - if (!calledRun && shouldRunNow) run(); + } + dependenciesFulfilled(); } } Module['removeRunDependency'] = removeRunDependency; |