Skip to content

Instantly share code, notes, and snippets.

@michealbenedict
Created March 12, 2011 10:55
Show Gist options
  • Save michealbenedict/867188 to your computer and use it in GitHub Desktop.
Save michealbenedict/867188 to your computer and use it in GitHub Desktop.
Javascript Related Blog Links + Basic Inheritance
// Best Practices
http://stackoverflow.com/questions/907225/object-oriented-javascript-best-practices
// Javascript + module Patter
http://www.adequatelygood.com/2010/3/JavaScript-Module-Pattern-In-Depth
// Wrapping Func in JS
http://peter.michaux.ca/articles/wrapping-functions-in-javascript
// JS for Extreme Performance
http://codeutopia.net/blog/2009/04/30/optimizing-javascript-for-extreme-performance-and-low-memory-consumption/
//Extending Classes
http://www.bennadel.com/blog/1514-Extending-Classes-In-Object-Oriented-Javascript.htm
http://phrogz.net/js/classes/ExtendingJavaScriptObjectsAndClasses.html
// Sugar Functions
if (typeof Object.create !== 'function') {
Object.create = function (o) {
function F() {}
F.prototype = o;
return new F();
};
}
var MODULE = (function () {
my = function(){
this.params = ""
},
privateVariable = 1;
my.prototype.moduleMethod = function () {
console.log("mod");
};
return my;
}());
var MODULE = (function (my) {
my.prototype.anotherMethod = function () {
console.log("asd");
};
return my;
}(MODULE));
var mObj = new MODULE();
mObj.moduleMethod();
mObj.anotherMethod();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment