Is there an easy way so that the closure compiler can export the class and all its prototypes and static methods and save the names as a public API? By default, the advanced option renames all variables, but you can export the material to the global area, for example:
window['MyClass'] = MyClass;
However, this only exports MyClass to the global scope, all prototypes and static methods are renamed. One would think that you could go through prototypes and export them, bu no:
for (var i in MyClass.prototype) { window['MyClass'].prototype[i] = MyClass.prototype[i]; }
This does not work. The only way I know is to manually add them as follows:
window['MyClass'].prototype['myFunction'] = MyClass.prototype.myFunction;
I want to exhibit about 50 prototypes, so this method is not preferred. Does anyone know how easy it is to export the whole class?
source share