я написал код скрипта и скомпилировал с помощью closure-util.но я не могу получить доступ к подобъекту экземпляра объекта.как исправить или написать код?я включил свой код ниже ...
main.js
goog.provide('org');
goog.provide('org.com');
/** @constructor */
org.com = function(){
this.name = "com";
console.log("created org.com");
}
/** @constructor */
org.com.init = function() {
console.log("org.com.init!!");
var obj = new org.com();
obj.init();
return obj
};
org.com.prototype.init = function(){
console.log("org.com.prototype.init");
try {
this.biz1 = new org.com.biz1;
} catch (e$1) {
this.biz1 = undefined;
}
if (this.biz1 != undefined) {
console.log("call biz1.prototype.init...");
this.biz1.init(this);//
}
}
/** @constructor */
org.com.biz1 = function(){
this.name = "biz1";
console.log("org.com.biz1");
}
org.com.biz1.prototype.init = function(parent){
console.log("org.com.biz1.prototype.init");
}
goog.exportSymbol('org.com',org.com);
goog.exportSymbol('org.com.init',org.com.init);
goog.exportSymbol('org.com.biz1',org.com.biz1);
goog.exportProperty(org.com.prototype,'init',org.com.prototype.init);
goog.exportProperty(org.com.biz1.prototype,'init',org.com.biz1.prototype.init);
config.json
"output_wrapper": "(function () {% output%}) ();"
index.html (консоль отладки Chrome)
> org
{com: ƒ}
--com: ƒ of()
----biz1: ƒ pf()
----init: ƒ ()
это нормально!то, что я ожидал.
> var obj = new org.com.init()
> obj
of {name: "com", a: pf}
--a: pf {name: "biz1"}
--name: "com"
из -> org.com (я хочу, чтобы 'com' вместо 'of')
a -> org.com.biz1 (я хочу, чтобы 'biz1' ожидал 'a')
пожалуйста, как исправить (или написать код)для этого?