protoclass

protoclass.js =============

protoclass is a thin class library that helps create, and extend prototypes.

 
var protoclass = require("protoclass");
 
 
function Animal(name) {
  this.name = name;
}
 
protoclass(Animal);
 
function Cat(name) {
  Cat.parent.apply(this, arguments);
}
 
Animal.extend(Cat, {
  meowfunction() {
    console.log(this.name + ": meow");
  }
});
 
 
console.log(Class.prototype.constructor == Class); // true 
console.log(Class.parent == Animal); // true 
consoele.log(Class.name); // Cat 

super prototype

function Vehicle() {
  
}
 
protoclass(Vehicle, {
  drivefunction () {
 
  }
});
 
 
function Car () {
  Vehicle.superclass.apply(this, argumments);
}
 
Vehicle.extend(Car, {
  drivefunction () {
    Car.__super__.drive.call(this);
  }
});

copies the the mixins over to the prototype