Merge pull request #752 from buu700/master

#747 fix
This commit is contained in:
Frank Denis 2018-09-04 15:45:58 +02:00 committed by GitHub
commit f8d39cd8a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -95,10 +95,10 @@ if [ "$DIST" = yes ]; then
Module['TOTAL_MEMORY'] = root['sodium']['totalMemory'];
}
var _Module = Module;
Module.ready = new Promise(function (resolve, reject) {
Module.ready = new Promise(function(resolve, reject) {
var Module = _Module;
Module.onAbort = reject;
Module.onRuntimeInitialized = function () {
Module.onRuntimeInitialized = function() {
try {
/* Test arbitrary wasm function */
Module._crypto_secretbox_keybytes();
@ -107,15 +107,15 @@ if [ "$DIST" = yes ]; then
reject(err);
}
};
Module.useBackupModule = function () {
Module.useBackupModule = function() {
var Module = _Module;
Module.onAbort = undefined;
Module.onRuntimeInitialized = undefined;
Module.useBackupModule = undefined;
Object.keys(Module).forEach(function(k) {
delete Module[k];
});
$(cat "${PREFIX}/lib/libsodium.asm.tmp.js" | sed 's|use asm||g')
};
$(cat "${PREFIX}/lib/libsodium.wasm.tmp.js")
}).catch(function () {
}).catch(function() {
_Module.useBackupModule();
});
EOM