Skip to content

Instantly share code, notes, and snippets.

@pbrewczynski
Created July 13, 2013 10:51
Show Gist options
  • Save pbrewczynski/5990314 to your computer and use it in GitHub Desktop.
Save pbrewczynski/5990314 to your computer and use it in GitHub Desktop.
/*Exports
This next variation allows us to declare globals without consuming them and could similarly support the concept of global imports seen in the last example.*/
// Global module
var myModule = (function () {
// Module object
var module = {},
privateVariable = "Hello World";
function privateMethod() {
// ...
}
module.publicProperty = "Foobar";
module.publicMethod = function () {
console.log( privateVariable );
};
return module;
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment