我建立一个test.js:
var Helloworld = function()
{
console.log("Hi..");
}
goog.exportSymbol('Helloworld', Helloworld);
然后,编译脚本为:
java -jar ../compiler.jar --compilation_level ADVANCED_OPTIMIZATIONS --js test.js --js_output_file test_out.js
编译生成的test_out.js内容是:
goog.a("Helloworld",function(){console.log("Hi..")});
然后写一个html文件,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>
可是运行的时候找不到Helloworld。到底该怎么使用这个exportSymbol啊?谢谢!
--
FROM 132.205.153.*