Class
Yet another wrapper for creating classes in js.
Installation
npm install osh-class
Example usage
var Class = ; // Pass in a prototype object.var Boat = ; // Or add non-constructor methods to prototype one-by-one.Boatprototype { this_running = false;}; // You don't have to use new Boat(), but can if you wantvar boat = ; // Subclass Boatvar Canoe = ; // Or like so,var QueenMary = Boat;
Documentation
Signature:
Class([Function super,] Object prototype)
The Class function takes 1 or 2 arguments. One of them is always a prototype for your class. If 2 arguments are given, the former is the super class and should be the result of a previous call to Class.
A Class constructor is equipped with a this._super(opts)
method,
var A = ;var B = ; var b = ;console; // 1
If an explicit constructor
function is not specified on a subclass,
the constructor
of the superclass will be used. For example,
var A = ;var B = ; var b = ;console; // 1
License
MIT