Is there an easy way for the closure compiler to be able to export a class and all it's prototypes & static methods and keep the names as a public API? Per default, the advanced option renames all variables, but you can export stuff to the global scope like:
window['MyClass'] = MyClass;
However, this only exports MyClass to the global scope, all prototypes and static methods are renamed. One would think that you can loop through through the prototypes and export them, bu no:
for (var i in MyClass.prototype) {
window['MyClass'].prototype[i] = MyClass.prototype[i];
}
This doesnt work. The only way I know is to manually add them like this:
window['MyClass'].prototype['myFunction'] = MyClass.prototype.myFunction;
I want to expose about 50 prototypes so this method is not preferred. Does anyone know how to export the entire class in a handy way?