Icontem

klass.js: Create classes with support to annotations

Recommend this page to a friend!
  Info   View files View files (7)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2013-12-16 (2 years ago) RSS 2.0 feedNot enough user ratingsTotal: 137 All time: 327 This week: 14Up
Version License JavaScript version Categories
klass-js 1.0.0GNU General Publi...1.0Data types, Node.js
Description Author

This object can create classes with support to annotations.

It can create classes with static, public and private methods and variables.

It also supports annotations that are extracted from comments in the class definition code.

Innovation Award
JavaScript Programming Innovation award nominee
December 2013
Number 3
The JavaScript object model is different of other languages which are class based.

This object can be used to define classes in JavaScript like in other languages with support to static, public and private methods and properties, as well for additional metadata in annotation comments.

Manuel Lemos
Picture of Rafael Lúcio
  Performance   Level  
Name: Rafael Lúcio <contact>
Classes: 11 packages by
Country: Brazil Brazil
Innovation award
Innovation award
Nominee: 3x

Details
### klassjs


It's a simple way to create classes with static, public and private methods/variables with the support of annotations.

### Example

All the files are under the example folder

```javascript
require ('../klass.js');
require ('./helloworld.js');
require ('./annotations/action.js');

var hw = new HelloWorld();
    hw.sayHi('poste9')
      .sayHello();

for(var key in hw)
{
    if (hw[key].hasAnnotation(Action))
    {
        console.log(key + " is an action!")
    }
    else
    {
        console.log(key + " is not an action!")
    }
}

/**
 * Expected out:
 Hi poste9
 Hello poste9
 sayHi is an action!
 sayHello is not an action!

 Process finished with exit code 0
 */
 ```
  Files folder image Files  
File Role Description
Files folder imageexample (2 files, 1 directory)
Plain text file klass.js Class Class source
Plain text file package.json Data Auxiliary data
Plain text file readme.md Data Auxiliary data

  Files folder image Files  /  example  
File Role Description
Files folder imageannotations (2 files)
  Plain text file helloworld.js Example Example script
  Plain text file test.js Example Example script

  Files folder image Files  /  example  /  annotations  
File Role Description
  Plain text file action.js Example Example script
  Plain text file annotation.js Example Example script

 Version Control Unique User Downloads Download Rankings  
 100%
Total:137
This week:0
All time:327
This week:14Up