diff options
-rw-r--r-- | src/shell.js | 4 | ||||
-rwxr-xr-x | tests/runner.py | 5 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/shell.js b/src/shell.js index 952f6899..2082eeae 100644 --- a/src/shell.js +++ b/src/shell.js @@ -9,6 +9,10 @@ // case, where this code here is minified but Module was defined // elsewhere (e.g. case 4 above). We also need to check if Module // already exists (e.g. case 3 above). +// Note that if you want to run closure, and also to use Module +// after the generated code, you will need to define var Module = {}; +// 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 (!Module) Module = eval('(function() { try { return {{{ EXPORT_NAME }}} || {} } catch(e) { return {} } })()'); diff --git a/tests/runner.py b/tests/runner.py index 77f36cf5..1948ab59 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -9528,7 +9528,10 @@ def process(filename): c2.virtualFunc2(); Module.print('*ok*'); ''' - src = open(filename, 'a') + code = open(filename).read() + src = open(filename, 'w') + src.write('var Module = {};\n') # name Module + src.write(code) src.write(script_src_2 + '\n') src.close() |