Skip to content

Instantly share code, notes, and snippets.

@wkronemeijer
Created November 2, 2013 16:51
Show Gist options
  • Save wkronemeijer/7280977 to your computer and use it in GitHub Desktop.
Save wkronemeijer/7280977 to your computer and use it in GitHub Desktop.
simple augmentation module system for javascript. usage:
function __module(base, name, func) {
if (typeof base[name] === 'undefined') {
base[name] = {};
}
func(base[name]);
}
//usage:
// __module(window.MyModule, 'namespace', function (exports) {
// exports.sayHello = function () {
// // ....
// }
// }
// MyModule.namespace.sayHello();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment