0.0.11 • Published 9 years ago

oo.js v0.0.11

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

oo.js

For nodejs object oriented helper. util.inherits object compatible.

Install

npm install -g oo.js

Example Abstract Define.

var oo = require('oo.js');
                
var Car = oo.class({
    public: {
        gas: 10,
        getGas: function() {
            return this.gas;
        },
        addGas: function(gas) {
            this.gas = this.gas + gas;
        }
    },

    abstract: [
        "run"
    ]
});

var SuperCar = oo.class({ extends: Car,
    public: {
        run: function() {
            this.gas = this.gas - 1;
        }
    }
});
            
var myCar = new SuperCar();
console.log(myCar.getGas()); // 10
                
myCar.run();
console.log(myCar.getGas()); // 9
                
myCar.addGas(3);
console.log(myCar.getGas()); // 12
0.0.11

9 years ago

0.0.10

9 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago