0.0.11 • Published 8 years ago

oo.js v0.0.11

Weekly downloads
2
License
MIT
Repository
github
Last release
8 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

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago