diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-04-05 16:48:38 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-04-05 16:48:38 -0700 |
commit | dc2a01d7f459dab9bf431fee51a10a5aa297bedc (patch) | |
tree | dbf8a184be27918eb98ab2c80204e7df1bf0aa0c /src/preamble.js | |
parent | 0c6c866d47b12a14f2dc8ffee2560cd633dce93f (diff) |
refactor preRun additions
Diffstat (limited to 'src/preamble.js')
-rw-r--r-- | src/preamble.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/preamble.js b/src/preamble.js index 392de7dc..fafc485c 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -865,6 +865,12 @@ Module['removeRunDependency'] = removeRunDependency; Module["preloadedImages"] = {}; // maps url to image data Module["preloadedAudios"] = {}; // maps url to audio data +function addPreRun(func) { + if (!Module['preRun']) Module['preRun'] = []; + else if (typeof Module['preRun'] == 'function') Module['preRun'] = [Module['preRun']]; + Module['preRun'].push(func); +} + #if PGO var PGOMonitor = { called: {}, @@ -878,8 +884,7 @@ var PGOMonitor = { } }; __ATEXIT__.push({ func: function() { PGOMonitor.dump() } }); -if (!Module.preRun) Module.preRun = []; -Module.preRun.push(function() { addRunDependency('pgo') }); +addPreRun(function() { addRunDependency('pgo') }); #endif function loadMemoryInitializer(filename) { |