Step 1: I create a test.js:
var Helloworld = function()
{
console.log("Hi..");
}
goog.exportSymbol('Helloworld', Helloworld);
Step 2: I compile the above javascript file using closure compiler:
java -jar ../compiler.jar --compilation_level ADVANCED_OPTIMIZATIONS --js test.js --js_output_file test_out.js
I can see the content of test_out.js:
goog.a("Helloworld",function(){console.log("Hi..")});'
I don't know what is the meaning of "goog.a".
Step 3: I create a test.html:
<html>
<head><title>Hello World</title></head>
<body>
<script src="closure-library/closure/goog/base.js"></script>
<script src="test_out.js"></script>
<script>
var v = new Helloworld();
</script>
</body>
</html>
Step 4: Load the html in the browser.
However, the Helloworld symbol cannot be found. What's wrong with my script to compile the javascript file? I'll appreciate if anyone can help. The document and tutorial of google closure is not very straightforward.
In your test.html, have you tried replacing:
with