Skip to content

Instantly share code, notes, and snippets.

@danielrohers
Last active February 13, 2017 13:57
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielrohers/9692611 to your computer and use it in GitHub Desktop.
Save danielrohers/9692611 to your computer and use it in GitHub Desktop.
My JavaScript Module Pattern
;(function (w, d, undefined) {
'use strict';
var app = (function () {
var exports = {};
var _privateMethod = function () {
return 'private method';
};
exports.publicMethod = function () {
return 'public method';
};
return exports;
})();
w.app = app;
/*
this is possible:
app.publicMethod();
this is not possible:
app._privateMethod();
app.privateMethod();
*/
})(window, document);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment