dcl.js
Version 2.x
dcl.js
is a standard kernel of dcl
. It implements OOP facilities, supercalls, AOP, chaining, and more utilities.
It is defined in dcl/dcl.js
, but being the main module can be available directly from dcl
.
Module API
The return value of this module is a function, which is called dcl()
in this documentation.
- dcl() - the main “class” composition engine
While it is important by itself, it hosts a number of public properties.
Main properties
- Super calls and AOP:
- dcl.superCall() - super call decorator
- dcl.advise() - AOP advise decorator, used to weave methods
- Helpers:
- dcl.before() - shortcut for a “before” advice
- dcl.after() - shortcut for an “after” advice
- dcl.around() - shortcut for an “around” advice (synonym for dcl.superCall())
- Chaining:
- dcl.chainWith() - function to declare chaining with a weaver for a method
- Helpers:
- dcl.chainBefore() - function to declare chaining “before” for a method
- dcl.chainAfter() - function to declare chaining “after” for a method
- Properties:
- dcl.prop() - custom property decorator, useful for getters/setters
Utilities
- dcl.isInstanceOf() - checks if an object is an instance of a constructor
Auxiliary properties
- Super calls and AOP:
- dcl.Super - constructor used by dcl.superCall() to create a decorator
- dcl.isSuper() - introspection helper to find a “super” property
- dcl.Advice - constructor used by dcl.advise() to create a decorator
- Chaining:
- dcl.weaveBefore - weaver to chain methods using “before” algorithm
- dcl.weaveAfter - weaver to chain methods using “after” algorithm
- dcl.weaveSuper - weaver to chain methods using “super” algorithm
- Properties:
- dcl.Prop - constructor used by
dcl.prop()
to create a decorator - dcl.getPropertyDescriptor() - finds a property descriptor across prototypes
- dcl.collectPropertyDescriptors() - collects property descriptors for an object across prototypes
- dcl.Prop - constructor used by