mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-20 02:25:14 -07:00
fix for asm.js async loading
This commit is contained in:
parent
d5115e26c8
commit
403da0d1fc
@ -118,20 +118,28 @@ if [ "$DIST" = yes ]; then
|
||||
}
|
||||
};
|
||||
Module.useBackupModule = function() {
|
||||
var Module = {};
|
||||
$(cat "${PREFIX}/lib/libsodium.asm.tmp.js" | sed 's|use asm||g')
|
||||
Object.keys(_Module).forEach(function(k) {
|
||||
if (k !== 'getRandomValue') {
|
||||
delete _Module[k];
|
||||
}
|
||||
});
|
||||
Object.keys(Module).forEach(function(k) {
|
||||
_Module[k] = Module[k];
|
||||
return new Promise(function(resolve, reject) {
|
||||
var Module = {};
|
||||
Module.onAbort = reject;
|
||||
|
||||
Module.onRuntimeInitialized = function() {
|
||||
Object.keys(_Module).forEach(function(k) {
|
||||
if (k !== 'getRandomValue') {
|
||||
delete _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")
|
||||
}).catch(function() {
|
||||
_Module.useBackupModule();
|
||||
return _Module.useBackupModule();
|
||||
});
|
||||
EOM
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user