convinient class definition with inheritance
abstract class a.k.a. interface support
runtime introspection with dynamic type checking
Install the package "simple-cls"
npm install simple-cls
To define a class, do the following
var cls =var MyClass = cls;
To instantiate an object and start using it
var obj = "hello";obj;console;
The prototype object itself is an object instance of the superclass of MyClass. If no superclass is given, it is defaulted to
MyClass is an alias of the Constructor function for obj
The Class object contains runtime information about the obj class and can be obtained via
__class on the constructor or
To check if a js object is an instance of a class, or an instance of a subclass of some super classes
To look at all the methods callable from the obj, including methods defined on the super class
For details, please look at the unit test examples.