SharedCode.js
(function () { "use strict";
var SharedCode = function() { }
$hxExpose(SharedCode, "SharedCode");
SharedCode.greet = function(name) {
console.log(name);
}
function $hxExpose(src, path) {
var o = typeof window != "undefined" ? window : exports;
var parts = path.split(".");
for(var ii = 0; ii < parts.length-1; ++ii) {
var p = parts[ii];
if(typeof o[p] == "undefined") o[p] = {};
o = o[p];
}
o[parts[parts.length-1]] = src;
}
})();
Module1.js
(function () { "use strict";
var Module1 = function() { }
Module1.main = function() {
SharedCode.greet("Jason");
}
Module1.main();
})();
Module2.js
(function () { "use strict";
var Module2 = function() { }
Module2.main = function() {
SharedCode.greet("Anna");
}
Module2.main();
})();