Created
March 12, 2011 10:55
-
-
Save michealbenedict/867188 to your computer and use it in GitHub Desktop.
Javascript Related Blog Links + Basic Inheritance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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