Created
December 8, 2013 22:06
-
-
Save bloodyowl/7864507 to your computer and use it in GitHub Desktop.
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
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