Hi everyone,
Thanks for coming! I just start to use Closure Library, and i am a bit confused about how it works. As a simple example, I am trying to access a compiled js module function. Please find my attached code below.
---------------hello.js--------------
goog.module('hhh');
goog.require('goog.dom');
var h111 = goog.require('h111')
function sayHi() {
var newHeader = goog.dom.createDom('h1', {'style': 'background-color:#EEE'},
'Hello world!');
goog.dom.appendChild(document.body, newHeader);
h111.sayHi1();
}
exports.sayHi = sayHi;
---------------------------------------
---------------hello1.js-------------
goog.module('h111');
goog.require('goog.dom');
function sayHi1() {
var newHeader = goog.dom.createDom('h1', {'style': 'background-color:#EEE'},
'Hello world1111111111!');
goog.dom.appendChild(document.body, newHeader);
}
exports.sayHi1 = sayHi1;
---------------------------------------
--------------hello.html------------
<html>
<head>
<script src="closure-library/closure/goog/base.js"></script>
<script src="hhh-compiled.js"></script>
</head>
<body>
<script>
// Here I need to access module function
</script>
</body>
</html>
______________________
The simple logic here is hello.js will hello1.js exported function, and it will then be called from html script.
Thanks a lot in advance! ;)