allow setting total memory from JS (#608)

This commit is contained in:
Ryan Lester 2017-10-04 20:26:00 -04:00 committed by Frank Denis
parent e784a3fb40
commit ec4432a388

View File

@ -74,9 +74,13 @@ if [ "$DIST" = yes ]; then
emccLibsodium "${PREFIX}/lib/libsodium.wasm.tmp.js" -O3 -s WASM=1
cat > "${PREFIX}/lib/libsodium.js" <<- EOM
var root = this.global || this.self || this.window || this;
if (typeof Module === 'undefined') {
var Module = {};
}
if (root.sodium && !isNaN(root.sodium.totalMemory)) {
Module.TOTAL_MEMORY = root.sodium.totalMemory;
}
var _Module = Module;
Module.ready = new Promise(function (resolve, reject) {
var Module = _Module;