1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-24 12:36:01 -07:00

Avoid losing the reference to Module in the promise.

by @buu700
This commit is contained in:
Frank Denis 2017-09-29 19:31:42 +02:00
parent 24ff2a7049
commit 3659d342af

View File

@ -77,11 +77,14 @@ if [ "$DIST" = yes ]; then
if (typeof Module === 'undefined') {
var Module = {};
}
var _Module = Module;
Module.ready = new Promise(function (resolve, reject) {
var Module = _Module;
Module.onAbort = reject;
Module.onRuntimeInitialized = resolve;
$(cat "${PREFIX}/lib/libsodium.wasm.tmp.js")
}).catch(function () {
var Module = _Module;
Module.onAbort = undefined;
Module.onRuntimeInitialized = undefined;
$(cat "${PREFIX}/lib/libsodium.asm.tmp.js" | sed 's|use asm||g')