Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    class.extendpublic

    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();
    

    install

    npm i class.extend

    Downloadsweekly downloads

    2,879

    version

    0.9.2

    license

    MIT

    repository

    github.com

    last publish

    collaborators

    • avatar