aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-09-12 22:06:28 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-09-12 22:11:25 -0700
commit27d496610e0ef93c9805a6a1a77de3f053405c6b (patch)
tree37a447c2ad397cb90d4ee8a2aee86d2b535daac2 /src
parent5912c32ab0da188196f5d486edc7fb5153f1ee65 (diff)
try to use console.log even in workers
Diffstat (limited to 'src')
-rw-r--r--src/shell.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/shell.js b/src/shell.js
index f91aa96a..7bfbe781 100644
--- a/src/shell.js
+++ b/src/shell.js
@@ -104,25 +104,26 @@ else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
Module['arguments'] = arguments;
}
- if (ENVIRONMENT_IS_WEB) {
+ if (typeof console !== 'undefined') {
Module['print'] = function(x) {
console.log(x);
};
-
Module['printErr'] = function(x) {
console.log(x);
};
-
- this['{{{ EXPORT_NAME }}}'] = Module;
- } else if (ENVIRONMENT_IS_WORKER) {
- // We can do very little here...
+ } else {
+ // Probably a worker, and without console.log. We can do very little here...
var TRY_USE_DUMP = false;
Module['print'] = (TRY_USE_DUMP && (typeof(dump) !== "undefined") ? (function(x) {
dump(x);
}) : (function(x) {
// self.postMessage(x); // enable this if you want stdout to be sent as messages
}));
+ }
+ if (ENVIRONMENT_IS_WEB) {
+ this['{{{ EXPORT_NAME }}}'] = Module;
+ } else {
Module['load'] = importScripts;
}
}