Joined October 2013
·
Alex Grande
San Francisco Bay Area
·
Posted to
The prototype is your friend (if you care about perf)
over 1 year
ago
I love the prototype. I encourage using the prototype modal even in a singleton pattern.
(function() {
function CoolClass() {};
CoolClass.prototype.coolestOfThemAll = function() {};
return new CoolClass();
})();
For something that is only to be instantiated once. Instead of the the classic singleton style:
Singleton = (function() {
return {
publicProperty: function() {}
}
})();