Skip to content

Instantly share code, notes, and snippets.

@ccapndave
Created June 4, 2012 09:56
Show Gist options
  • Select an option

  • Save ccapndave/2867552 to your computer and use it in GitHub Desktop.

Select an option

Save ccapndave/2867552 to your computer and use it in GitHub Desktop.
extend: function() {
var Class = makeCtor(), proto;
Class.ClassMixin = Ember.Mixin.create(this.ClassMixin);
Class.PrototypeMixin = Ember.Mixin.create(this.PrototypeMixin);
Class.ClassMixin.ownerConstructor = Class;
Class.PrototypeMixin.ownerConstructor = Class;
var PrototypeMixin = Class.PrototypeMixin;
PrototypeMixin.reopen.apply(PrototypeMixin, arguments);
Class.superclass = this;
Class.__super__ = this.prototype;
proto = Class.prototype = o_create(this.prototype);
proto.constructor = Class;
Ember.generateGuid(proto, 'ember');
meta(proto).proto = proto; // this will disable observers on prototype
Class.subclasses = Ember.Set ? new Ember.Set() : null;
if (this.subclasses) { this.subclasses.add(Class); }
Class.ClassMixin.apply(Class);
return Class;
},
create: function() {
var C = this;
if (arguments.length>0) { this._initMixins(arguments); }
return new C();
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment