0.9.0

API Management

Change the API symbol in the global variable namespace under which ComponentJS is exposed. By default ComponentJS is exposed under the symbol name ComponentJS. It is a common convention to change the symbol to cs (for "component system/service") to have a convenient short-hand.

Debugging

ComponentJS has special support for debugging its run-time processing, especially for visualizing the current component tree in real-time.

Code Structuring

ComponentJS internally uses a few code structuring utility functions for implementing class method parameters and class attributes. Those utility functions are also exposed for consumption by application developers, but they are NOT(!) required for using ComponentJS. Especially, it is NOT(!) required that component shadow objects are defined by cs.clazz!

Component Creation

Components are managed in hierarchical fashion within a component tree. The component tree can be traversed and its components can be created, looked up, state transitioned, communicated on and be destroyed.

Component Information

Components carry a few distinct information. They can be accessed via the following getter/setter-style methods.

Component Lookup

Before performing certain operations on a component, it first have to be looked up in the component tree. As this is one of the most prominent functionalities of ComponentJS, it is directly exposed through the global API symbol.

Component Tree

Components are managed within a component tree. The following functions allow you to traverse this tree.

States

Components, during their life-cycle, are in various particular states. Components can be triggered to change their state. During those state transitions, enter and leave methods are called accordingly.

Spools

In ComponentJS there are at least 4 resource allocating operations which have corresponding deallocation operations: Model observe/unobserve, Socket plug/unplug, Event subscribe/unsubscribe, Service register/unregister and Hook latch/unlatch. For correct run-time operation it is required that each allocation operation, performed in a state enter method, is properly reversed with the corresponding deallocation operation in the state leave method. As this is extremely cumbersome (especially because you have to store the identifiers returned by the allocation operations as you need them for the deallocation operation), ComponentJS provides a convenient spool mechanism which all of the above allocation operations support and which also can be used by the application itself.

Properties

Every component can have an arbitrary number of key/value based properties attached to it. The keys have to be of type String, the values can be of any type. A property is set on a target component but is resolved on both the target component and all parent components (up to and including the root component). This way properties feel like inherited and overrideable values which can be used for both storing component-local information and to communicate information to foreign components.

Sockets

Sockets are a special form of component Properties with callback functions as the values. They are intended to link Views of child/descendant components into the View of a parent/ancestor component. In contrast to regular Properties, Sockets are never resolved directly on the target component. Instead they always start to resolve on the parent component because the sockets on the target component are intended for its child/ancestor components and not for the target component itself.

Models

When using Model/View/Controller roles for components, the Model component needs a so-called Presentation Model: an abstraction of presentation onto which both View and Controller components attach via Observer pattern. The Controller component for provisioning business information into the Model and triggering business services upon Model changes. The View component for displaying the Model information and storing events into it.

Events

The Event mechanism is a central one in ComponentJS. Both Models, Services and Hooks are all internally based on the Events mechanism. An Event is an object published towards a target component. It is delivered in 4 phases: in phase 1 (the "capturing" phase) the Event is delivered to all components on the path from the root component (inclusive) towards the target component (exclusive); in phase 2 (the "targeting" phase) the Event is delivered to the target component; in phase 3 (the "spreading" phase) the Event is delivered to all descendant components of the target component in a depth-first traversal order and in phase 4 (the "bubbling" phase) the Event is delivered (again) to all components on the path from the target component (exclusive) to the root component (inclusive).

Event objects are implicitly created by the publish() operation and they provide various getter/setter methods: target (Component): target component the event is send to; propagation (Boolean): whether event propagation should continue; processing (Boolean): whether final default event processing should be performed; dispatched (Boolean): whether event was dispatched at least once to a subscriber; decline (Boolean): whether event was declined by subscriber; state (Boolean): state of dispatching: capturing, targeting, spreading or bubbling; result (Object): optional result value event subscribers can provide; async (Boolean): whether event is dispatched asynchronously.

Services

FIXME

Hooks

FIXME