Is it possible, using Google Closure compiler, to define a class in two files? For example, if I auto-generate one class and want to keep another one for user-entered code:
In MyClass.AutoGenerated.js
goog.provide("MyClass");
MyClass = function() {
}
MyClass.prototype.SomeMember = 15;
And then in MyClass.js, continue declaring members and functions:
MyClass.prototype.AnotherMember = 15;
MyClass.prototype.SomeAwesomeFunction = function() {};
The only way I found to come close to this, without relying on build order is this:
In MyClass.js
And then in MyClass.Partial.js, continue declaring members and functions and provide a namespace with .Partial (for example):
Then the calling code must call:
in order to include both files in the right order. The MyClass.Partial class does not need to exist in any way; it is just an identifier used by the goog.require and goog.provide methods.