Javascript Closure compiler -Exporting global variables
问题 My webapp is based on a common script where I define the common functions and a global variable and dynamically loaded scripts that process those. So far, the only way I found to export the global variable is to replace any occurrence by window["myGlobalVar"] but I find it very ugly. Is there a better way to do? Here is an illustration // commonscript.js before compilation function incrementVariable() {window["myGlobalVar"]++;} window["incrementVariable"] = incrementVariable; window[