aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/preamble.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/preamble.js b/src/preamble.js
index f85cf4f3..392de7dc 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -882,5 +882,23 @@ if (!Module.preRun) Module.preRun = [];
Module.preRun.push(function() { addRunDependency('pgo') });
#endif
+function loadMemoryInitializer(filename) {
+ function applyData(data) {
+ HEAPU8.set(data, TOTAL_STACK);
+ }
+
+ if (ENVIRONMENT_IS_NODE || ENVIRONMENT_IS_SHELL) {
+ // synchronous
+ applyData(Module['readBinary'](filename));
+ } else {
+ // asynchronous
+ Browser.asyncLoad(filename, function(data) {
+ applyData(data);
+ }, function(data) {
+ throw 'could not load memory initializer ' + filename;
+ });
+ }
+}
+
// === Body ===