1.0.10 • Published 9 years ago

ozero v1.0.10

Weekly downloads
72
License
-
Repository
github
Last release
9 years ago

Define Classes in Javascript

This is a module providing a OOP functionality for javascript, currently in development.

Install

For Node.js

npm install ozero

How to Use

With Node.js:

// simple-module.js 
with(require('ozero')(module)){
    O.import('any-module');
    /**
     * Private class definition 
     * @class PrivateClass
     */
    O.define('PrivateClass', BaseClass, FirstTrait, SecondTrait,{
        '#static'           : {
            STATIC_CONST    : 'static constant value',
            staticField     : 'static field value',
            staticMethod    : function(){
                // ... 
            }
        },
        '#instance'         : {
            constructor     : function(firstParam,secondParam){
                this.super(firstParam); //call to BaseClass.constructor
            },
            instanceField   : 'instance field value'
            instanceMethod  : function(firstParam,secondParam){
                this.super(firstParam); //call to BaseClass.instanceMethod
            }
        }
        
    });
    /**
     * Public or exported class definition 
     * @class PrivateClass
     */
    O.define('PublicClass', BaseClass, FirstTrait, SecondTrait, {
        // ....
    });
}
// simple-module-useage.js
with(require('ozero')(module)){
    O.import('any-module',{
        PublicClass : 'RenamedClass'
    });
    
    RenamedClass.staticMethod('A','B');
    
    var renamed = new RenamedClass();
    renamed.instanceMethod('A','B');
    
}
1.0.10

9 years ago

1.0.9

9 years ago

1.0.8

9 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

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

0.0.1

10 years ago