fix for asm.js async loading

This commit is contained in:
Ryan Lester 2019-09-11 10:49:46 -04:00 committed by Frank Denis
parent d5115e26c8
commit 403da0d1fc

View File

@ -118,20 +118,28 @@ if [ "$DIST" = yes ]; then
} }
}; };
Module.useBackupModule = function() { Module.useBackupModule = function() {
var Module = {}; return new Promise(function(resolve, reject) {
$(cat "${PREFIX}/lib/libsodium.asm.tmp.js" | sed 's|use asm||g') var Module = {};
Object.keys(_Module).forEach(function(k) { Module.onAbort = reject;
if (k !== 'getRandomValue') {
delete _Module[k]; Module.onRuntimeInitialized = function() {
} Object.keys(_Module).forEach(function(k) {
}); if (k !== 'getRandomValue') {
Object.keys(Module).forEach(function(k) { delete _Module[k];
_Module[k] = Module[k]; }
});
Object.keys(Module).forEach(function(k) {
_Module[k] = Module[k];
});
resolve();
};
$(cat "${PREFIX}/lib/libsodium.asm.tmp.js" | sed 's|use asm||g')
}); });
}; };
$(cat "${PREFIX}/lib/libsodium.wasm.tmp.js") $(cat "${PREFIX}/lib/libsodium.wasm.tmp.js")
}).catch(function() { }).catch(function() {
_Module.useBackupModule(); return _Module.useBackupModule();
}); });
EOM EOM