0.0.4 • Published 10 years ago

extends v0.0.4

Weekly downloads
267
License
-
Repository
github
Last release
10 years ago

Extends

A method to extend classes in Javascript.

Features:

  • super method calling this._super()
  • static properties
  • object cloning with this.clone()

Examples:

var Class = function() {};

var Stuff = extend(Class, {
	statics: {
		COLOR_RED: 'red',
		COLOR_BLUE: 'blue'
	},
	
	setColor: function(color) {
		this.color = color;
	}
});

// extended classes will have a .extend method
var Ball = Stuff.extend({
	setColor: function(color) {
		this._super(color);
		this.updateBallColor();
	},
	updateBallColor: function() {
		// do something	
	}
});
0.0.4

10 years ago

0.0.3

11 years ago

0.0.2

11 years ago

0.0.1

11 years ago