Class
Class is a meta-factory function to create classes in JavaScript. It is a shortcut for the CreateJS syntax style. By default, the class created by this function have an initialize function (the constructor). Optionally, you can specify the inheritance by passing another class as parameter.
By default, all classes created using this function, may receive only a dictionary parameter as argument. This pattern is commonly used by jQuery and its plugins.
Since 0.2.0, Class also receives a properties parameter, a dictionary
which will be used to fill the new class prototype.
Usage
// Creating a simple class
var BaseClass = b3.Class();
var ChildClass = b3.Class(BaseClass, {
// constructor
initialize: function(params) {
// call super initialize
BaseClass.initialize.call(this, params);
...
}
});
Assignature
Class
(
Object
-
baseClass -
properties
Parameters:
-
baseClassObjectThe super class.
-
propertiesObjectA dictionary with attributes and methods.
Returns:
Object:
A new class.
