logo

/Code Snippet|v2.2.0

Module

Static Methods

createObject(obj)createObject.jsline 18

Create a new object with the specified prototype object and properties.

PARAMETERS
NameTypeDescription

obj

Object

This object will be a prototype of the newly-created object.

RETURNS:
{

Object

}

inherit(subType, superType)inherit.jsline 43

Provide a simple inheritance in prototype-oriented.
Caution :
Don't overwrite the prototype of child constructor.

PARAMETERS
NameTypeDescription

subType

function

Child constructor

superType

function

Parent constructor

EXAMPLES
var inherit = require('tui-code-snippet/inheritance/inherit'); // node, commonjs

// Parent constructor
function Animal(leg) {
    this.leg = leg;
}
Animal.prototype.growl = function() {
    // ...
};

// Child constructor
function Person(name) {
    this.name = name;
}

// Inheritance
inherit(Person, Animal);

// After this inheritance, please use only the extending of property.
// Do not overwrite prototype.
Person.prototype.walk = function(direction) {
    // ...
};
Resizable