Clazz.js
Clazz.js is a simple JavaScript class providing liblary.
Getting Started
using in webapp
Download js file from here.
var MyClass = { thismessage = message; } { console; }; var myClass = 'I am an instance of MyClass.';myClass;
using in node.js app
Install the module with: npm install clazzjs
var Clazz = ; var MyClass = { thismessage = message; } { console; }; var myClass = 'I am an instance of MyClass.';myClass;
Documentation
Create a Class
var MyClass = // The first argument is a instance method module. { // "init" is a special method which is executed in the constructor. } { // you can define } someAttribute: '' // The second argument is a static method module. { }; ; // calling a instance method.MyClass; // calling a static method.
Inheritance
Clazz.js supports Inheritance. Use "extend" method to create a sub class. In subclass method, you can use access super method by "_dl" property. The "_dl" property returns a function to delegate super method.
var SubClass = MyClass;
Mix in
Using "mixin" method, you can import an external module to your class.
var module = { console; };; var MyClass = { thismessage = message; };'Hello!'action; // -> 'Hello!'
Examples
(Coming soon)
Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
Release History
(Nothing yet)
License
Copyright (c) 2013 quramy. Licensed under the MIT license.