0.0.1 • Published 10 years ago

@frzr/inherit v0.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
10 years ago

inherit

simple class inheritance

install

npm install @frzr/inherit

example

var inherit = require('@frzr/inherit')

function Model () {
  console.log('constructor works')
  Model.super.call(this)
}

function SuperModel () {
  console.log('super call works')
}

inherit(Model, SuperModel)

Model.prototype.proto = function () {
  console.log('proto works')
}
SuperModel.prototype.superproto = function () {
  console.log('inherited proto works')
}

var model = new Model()

model.proto()
model.superproto()

console.log('is SuperModel:' + (model instanceof SuperModel))