summaryrefslogtreecommitdiffstats
path: root/platform/javascript/engine.js
diff options
context:
space:
mode:
authorLeon Krause <lk@leonkrause.com>2018-03-27 09:06:19 +0200
committerLeon Krause <lk@leonkrause.com>2018-03-27 09:12:08 +0200
commit63c7fc6358343c3de6cfaa40436063646eb8b7a1 (patch)
tree2712129fdd6faf5c0ba4622cf51bfa056bcd080d /platform/javascript/engine.js
parentd8d9eea72252e5b667537261ea40fec18cf1f809 (diff)
downloadredot-engine-63c7fc6358343c3de6cfaa40436063646eb8b7a1.tar.gz
Expose Emscripten libs to engine.js discreetly
Diffstat (limited to 'platform/javascript/engine.js')
-rw-r--r--platform/javascript/engine.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/platform/javascript/engine.js b/platform/javascript/engine.js
index e6fb48d0d2..c54ccef1eb 100644
--- a/platform/javascript/engine.js
+++ b/platform/javascript/engine.js
@@ -1,3 +1,4 @@
+ exposedLibs['FS'] = FS;
return Module;
},
};
@@ -31,6 +32,8 @@
this.rtenv = null;
+ var LIBS = {};
+
var initPromise = null;
var unloadAfterInit = true;
@@ -80,7 +83,7 @@
return new Promise(function(resolve, reject) {
rtenvProps.onRuntimeInitialized = resolve;
rtenvProps.onAbort = reject;
- rtenvProps.engine.rtenv = Engine.RuntimeEnvironment(rtenvProps);
+ rtenvProps.engine.rtenv = Engine.RuntimeEnvironment(rtenvProps, LIBS);
});
}
@@ -163,7 +166,7 @@
this.rtenv.thisProgram = executableName || getBaseName(basePath);
preloadedFiles.forEach(function(file) {
- this.rtenv.FS.createDataFile('/', file.name, new Uint8Array(file.buffer), true, true, true);
+ LIBS.FS.createDataFile('/', file.name, new Uint8Array(file.buffer), true, true, true);
}, this);
preloadedFiles = null;