Created
December 31, 2017 14:28
-
-
Save savokiss/b1ee4a3f752200d1bf11ad62d976a79d to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Class = (function() { | |
function init() { | |
return function() { | |
if (this.initialize) { | |
this.initialize.apply(this, arguments); | |
} | |
}; | |
} | |
function extend(protoProps, staticProps) { | |
var parent = this; | |
var child = init(); | |
window.$.extend(child, parent, staticProps); | |
var proto = Object.create(parent.prototype); | |
proto.constructor = child; | |
child.prototype = proto; | |
window.$.extend(child.prototype, protoProps); | |
child.superClass = parent.prototype; | |
return child; | |
} | |
var Class = function(protoProps) { | |
var cls = init(); | |
window.$.extend(cls.prototype, protoProps); | |
cls.extend = extend; | |
return cls; | |
}; | |
Class.extend = extend; | |
return Class; | |
})(); | |
export default Class | |
// WEBPACK FOOTER // | |
// ./src/utility/class.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment