Skip to content

Instantly share code, notes, and snippets.

@catacs
Created February 15, 2016 15:40
Show Gist options
  • Save catacs/c677768ec1e4f6da6b58 to your computer and use it in GitHub Desktop.
Save catacs/c677768ec1e4f6da6b58 to your computer and use it in GitHub Desktop.
Singleton pattern javascript
var Singleton = (function () {
var privateVariable = 'value';
function privateFunction() {
}
function publicFunction() {
}
return {
publicFunction: publicFunction,
};
})();
// http://blog.mixu.net/2011/02/02/essential-node-js-patterns-and-snippets/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment