Skip to content

Copy/Paste node package implementation of John Resig's javascript object inheritance

Notifications You must be signed in to change notification settings

silvermine/class.extend

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

class.extend

copy/paste node package implementation of John Resig's simple javascript inheritance, http://ejohn.org/blog/simple-javascript-inheritance

Install

npm install class.extend

Usage

var Class = require('class.extend');

var Person = Class.extend('Person', {
  init: function(isDancing){
    this.dancing = isDancing;
  },
  dance: function(){
    return this.dancing;
  }
});
 
var Ninja = Person.extend('Ninja', {
  init: function(){
    this._super( false );
  },
  dance: function(){
    // Call the inherited version of dance()
    return this._super();
  },
  swingSword: function(){
    return true;
  }
});
 
var p = new Person(true);
 
var n = new Ninja();

About

Copy/Paste node package implementation of John Resig's javascript object inheritance

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 96.3%
  • Makefile 3.7%