Class Creator

We have introduced a library method to create classes in JavaScript that can be easily inherited and that supports Atoms property system.

createClass

name: String

Name of class, it is stored as __type in prototype useful for debugging.

baseType: prototype of base class

Prototype of base class, please follow the example given below to correctly create prototype chains.

start: Function

Constructor function that will be called when object is initialized. Before this function is executed, baseType's constructor will be executed first.

properties: Key-Value pairs (Object)

Object with key-value pairs, key determines name of property and values are default values when the object is created. Please note, this will create get_/set_ methods in prototype.

methods: Key-Value pairs (Object)

Object with key-value pairs, key determines name of method and values are functions.

Performance

In order to improve performance, we flatten protoype chain by manually copying baseType's prototype methods to current prototype

This results in excellent performance but blocks you from modifying prototype after the class is created.

Example