Skip to content

Instantly share code, notes, and snippets.

@speedmax
Created August 14, 2008 04:47
Show Gist options
  • Save speedmax/5369 to your computer and use it in GitHub Desktop.
Save speedmax/5369 to your computer and use it in GitHub Desktop.
var Class = new Native({
name: 'Class',
initialize: function(properties){
properties = properties || {};
var klass = function(){
for (var property in this) this[property] = $unlink(this[property]);
this.parent = null;
for (var Property in Class.Mutators){
if (!this[Property]) continue;
Class.Mutators[Property](this, this[Property]);
delete this[Property];
}
this.constructor = klass;
var self = (arguments[0] !== $empty && this.initialize) ? this.initialize.apply(this, arguments) : this;
if (this.options && this.options.initialize) this.options.initialize.call(this);
return self;
};
$extend(klass, this);
klass.constructor = Class;
klass.prototype = properties;
return klass;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment