Skip to content

Instantly share code, notes, and snippets.

@jonobr1
Last active August 29, 2015 14:05
Show Gist options
  • Save jonobr1/aeffaba1fa3387c2c8b3 to your computer and use it in GitHub Desktop.
Save jonobr1/aeffaba1fa3387c2c8b3 to your computer and use it in GitHub Desktop.
Export private class to external object.
/*
* Base class
*/
(function() {
var root = this;
var previousBase = root.Base || {};
var foo = 1;
var Base = root.Base = {
version: foo,
noConflict: function() {
root.Base = previousBase;
return Base;
}
};
})();
/**
* Subsidiary class
*/
(function() {
var foo = 5;
var Child = Base.Child = function() { };
Child.prototype.age = foo;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment