Skip to content

Instantly share code, notes, and snippets.

@bloodyowl
Created December 8, 2013 22:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bloodyowl/7864507 to your computer and use it in GitHub Desktop.
Save bloodyowl/7864507 to your computer and use it in GitHub Desktop.
var klass = (function(){
var k = {}
, createObject =
typeof Object.create == "function" ?
function(object){
return Object.create(object)
} :
function(object){
function F(){}
F.prototype = object
return new F()
}
k.create = function(){
var self = createObject(this)
if(typeof self.constructor == "function") {
self.constructor.apply(self, arguments)
}
return self
}
k.extend = function(){
return createObject(this)
}
return k
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment