1.1.0origin inherit from node util BUT super called like "super"
(Function)
constructor to extend
(Function)
constructor which will be installed as "super"
Function:
constructor
var inherit = require('s-inherit');
var DecoratedClass = inherit(Class, Parent);
Make new Constructor with nested construction of a chain of prototypes hard relation of child constructor to parent constructor. The "super" defined from static method "_setSuper". If it absent Constructor lose ability call to Parent.
(Function)
constructor to extend
(Function)
constructor which will be installed as "super"
Function:
constructor
var inherit = require('s-inherit');
//
function Parent () { ... }
//
function Child ( data ) {
// Adding personal owned properties to the parent
this.superUniqueProperty.call(this, data);
// own properties of the constructor and/or overrides
this.props = 1;
}
Child._setSuper = function ( Parent ) {
this.superUniqueProperty = Parent;
}
// Constructor with nested construction of a chain of prototypes
var Inheritor = inherit._related(Child, Parent);
Make new Constructor with nested construction of a chain of prototypes hard relation of child constructor to parent constructor. The "super" defined from static method "_setSuper". If it absent Constructor lose ability call to Parent context. No limit for nested construction of a chain of prototypes.
(Function)
constructor to extend
(Function)
constructor which will be installed as "super"
(Function?)
constructor which will be installed as "super" as many times as you need
Function:
constructor
var inherit = require('s-inherit');
// it will give ability to combine inheritance any to any
function Parent1 () { ... }
Parent1._setSuper = function ( Parent ) { this.p1 = Parent; }
function Parent2 () { ... }
Parent2._setSuper = function ( Parent ) { this.p2 = Parent; }
function Parent3 () { ... }
Parent3._setSuper = function ( Parent ) { this.p3 = Parent; }
function Parent4 () { ... }
Parent4._setSuper = function ( Parent ) { this.p4 = Parent; }
//
function Child ( data ) {
// Adding personal owned properties to the parent
this.superUniqueProperty.call(this, data);
// own properties of the constructor and/or overrides
this.props = 1;
}
Child._setSuper = function ( Parent ) {
this.superUniqueProperty = Parent;
}
// Constructor with nested construction of a chain of prototypes
var Inheritor = inherit.extend(Child, Parent1, Parent2, Parent3, Parent4);
Make a new constructor using every transferred class and/or Object as decorator. Constructor steel have it own prototype, but have all own props from all decorators. Can be used as binded Constructor properties.
Function:
constructor
var inherit = require('s-inherit');
var DecoratedClass = inherit.decorate(Cube, {top: 100, left: 100}, {width: 100, heigh: 100, long: 100});
defination on platforms (both variants on platform like Electron)
bower i --save s-inherit
npm i --save s-inherit
window.inherit // in browser
var inherit = require('s-inherit') // in Node.js