【发布时间】:2012-07-01 10:10:32
【问题描述】:
我有一些看起来像这样的代码:
var MyObject = function () {
this.Prop1 = "";
this.Prop2 = [];
this.Prop3 = {};
this.Prop4 = 0;
}
然后我有这个:
var SomeObject = new MyObject();
当我在高级模式下通过闭包编译器运行我的代码时,我在有this.Prop = 的每一行都收到警告dangerous use of the global this object
我在做什么是“危险的”,我应该如何重写我的代码?
感谢您的建议。
【问题讨论】:
标签: javascript google-closure-compiler