My coding project involves implementing a class with the following structure:
function ExampleClass() {
// constructor code
}
ExampleClass.prototype.sampleFunc = function () {
// sample function
};
ExampleClass.staticSampleFunc = function () {
// static sample function
};
I've dedicated time to setting up closure compiler annotations to eliminate all warnings. Surprisingly, this resulted in a 100% reduction in size. However, I recently learned about exporting functions and discovered that using
window['ExampleClass'] = ExampleClass
only exports the constructor. Exporting each method individually is not my preferred option. I assumed the compiler would export and avoid obfuscating all publicly accessible methods other than those marked with a @private
annotation.
What strategy should I employ to instruct the closure compiler to handle this without requiring individual method exports?