1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-23 20:15:19 -07:00

Merge pull request #691 from buu700/master

Run-time wasm test before resolving ready
This commit is contained in:
Frank Denis 2018-03-06 09:53:30 +01:00 committed by GitHub
commit cab7cc6a88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -99,7 +99,15 @@ if [ "$DIST" = yes ]; then
Module.ready = new Promise(function (resolve, reject) {
var Module = _Module;
Module.onAbort = reject;
Module.onRuntimeInitialized = resolve;
Module.onRuntimeInitialized = function () {
try {
/* Test arbitrary wasm function */
Module._crypto_stream_chacha20_keybytes();
resolve();
} catch (err) {
reject(err);
}
};
$(cat "${PREFIX}/lib/libsodium.wasm.tmp.js")
}).catch(function () {
var Module = _Module;