Skip to content

Instantly share code, notes, and snippets.

@dgowrie
Created October 4, 2015 06:44
Show Gist options
  • Save dgowrie/29b270c5545e44dc08d5 to your computer and use it in GitHub Desktop.
Save dgowrie/29b270c5545e44dc08d5 to your computer and use it in GitHub Desktop.
Yet another iteration of (revealing)Prototype Pattern with private/public methods
var myPrototypeModule = (function() {
'use strict';
var privateVar = 'Alex Castrounis',
count = 0;
function PrototypeModule(name) {
this.name = name;
}
function privateFunction() {
console.log('Name:' + privateVar);
count++;
}
PrototypeModule.prototype.setName = function(strName) {
this.name = strName;
};
PrototypeModule.prototype.getName = function() {
privateFunction();
};
return PrototypeModule;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment