aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/settings.js1
-rw-r--r--src/shell.js4
2 files changed, 5 insertions, 0 deletions
diff --git a/src/settings.js b/src/settings.js
index 02f6c8b5..1c41676d 100644
--- a/src/settings.js
+++ b/src/settings.js
@@ -133,6 +133,7 @@ var PRECISE_F32 = 0; // 0: Use JS numbers for floating-point values. These are 6
// therefore recommended.
var SIMD = 0; // Whether to emit SIMD code ( https://github.com/johnmccutchan/ecmascript_simd )
+var CLOSURE_COMPILER = 0; // Whether closure compiling is being run on this output
var CLOSURE_ANNOTATIONS = 0; // If set, the generated code will be annotated for the closure
// compiler. This potentially lets closure optimize the code better.
diff --git a/src/shell.js b/src/shell.js
index 65f7b923..e1c0eb54 100644
--- a/src/shell.js
+++ b/src/shell.js
@@ -14,7 +14,11 @@
// before the code. Then that object will be used in the code, and you
// can continue to use Module afterwards as well.
var Module;
+#if CLOSURE_COMPILER
if (!Module) Module = eval('(function() { try { return {{{ EXPORT_NAME }}} || {} } catch(e) { return {} } })()');
+#else
+if (!Module) Module = (typeof {{{ EXPORT_NAME }}} !== 'undefined' ? {{{ EXPORT_NAME }}} : null) || {};
+#endif
// Sometimes an existing Module object exists with properties
// meant to overwrite the default module functionality. Here