Skip to content

Instantly share code, notes, and snippets.

@savokiss
Created December 31, 2017 14:28
Show Gist options
  • Save savokiss/b1ee4a3f752200d1bf11ad62d976a79d to your computer and use it in GitHub Desktop.
Save savokiss/b1ee4a3f752200d1bf11ad62d976a79d to your computer and use it in GitHub Desktop.
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