Skip to content

Instantly share code, notes, and snippets.

@danielrohers danielrohers/app.js
Last active Feb 13, 2017

Embed
What would you like to do?
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
You can’t perform that action at this time.