Properly check if console exists.

This commit is contained in:
bas-d 2019-05-12 13:04:11 +02:00 committed by Frank Denis
parent 1b419ba366
commit 5b9bc08d2f

View File

@ -99,6 +99,16 @@ if [ "$DIST" = yes ]; then
Module.ready = new Promise(function(resolve, reject) { Module.ready = new Promise(function(resolve, reject) {
var Module = _Module; var Module = _Module;
Module.onAbort = reject; Module.onAbort = reject;
Module.print = function(what) {
if (typeof(console) !== 'undefined') {
console.log(what);
}
}
Module.printErr = function(what) {
if (typeof(console) !== 'undefined') {
console.warn(what);
}
}
Module.onRuntimeInitialized = function() { Module.onRuntimeInitialized = function() {
try { try {
/* Test arbitrary wasm function */ /* Test arbitrary wasm function */