aboutsummaryrefslogtreecommitdiff
path: root/src/preamble.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/preamble.js')
-rw-r--r--src/preamble.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/preamble.js b/src/preamble.js
index c8f93b56..1fec1301 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -655,8 +655,10 @@ Module['String_copy'] = String_copy;
// Tools
-if (typeof print === 'undefined') {
- this['print'] = console.log; // we are on the web
+if (typeof console === 'object' && typeof console.log === 'function') {
+ this['print'] = function(x) { console.log(x) }; // web console
+} else if (typeof print === 'undefined') {
+ this['print'] = function(){}; // harmless no-op
}
// This processes a JS string into a C-line array of numbers, 0-terminated.