1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 09:49:28 +02:00
Oinktube/node_modules/class.extend
2022-06-30 12:23:35 -03:00
..
lib Do not ignore node_modules 2022-06-30 12:23:35 -03:00
test Do not ignore node_modules 2022-06-30 12:23:35 -03:00
.npmignore Do not ignore node_modules 2022-06-30 12:23:35 -03:00
Makefile Do not ignore node_modules 2022-06-30 12:23:35 -03:00
package.json Do not ignore node_modules 2022-06-30 12:23:35 -03:00
README.md Do not ignore node_modules 2022-06-30 12:23:35 -03:00

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({
  init: function(isDancing){
    this.dancing = isDancing;
  },
  dance: function(){
    return this.dancing;
  }
});
 
var Ninja = Person.extend({
  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();