All Projects → tobytailor → Def.js

tobytailor / Def.js

Licence: mit
Simple Ruby-style inheritance for JavaScript

Programming Languages

javascript
184084 projects - #8 most used programming language

Simple Ruby-style inheritance for JavaScript

Example

def ("Person") ({
	init: function(name){
		this.name = name;
	},
	
	speak: function(text){
		alert(text || "Hi, my name is " + this.name);
	}
});

def ("Ninja") << Person ({
	init: function(name){
		this._super();
	},
	
	kick: function(){
		this.speak("I kick u!");
	}
});

var ninjy = new Ninja("JDD");

ninjy.speak();
ninjy.kick();
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].