Cluster
Last updated
Was this helpful?
Last updated
Was this helpful?
A Cluster is just a wrapper, a group, of two or more ActiveJS fundamental constructs, , , , or even .
It creates a master Observable of the combined value of its members by merging all the provided Observable constructs. Whenever any of these wrapped constructs emits a value, Cluster emits a new combined-value.
It also provides direct access to the wrapped constructs through items
property.
The ideal use case would be when you need access to the combined value of some ActiveJS constructs as an Observable.
Basically,
It creates a master Observable of the combined -value of provided members.
Provides access to its members through the Cluster.
Provides static access to the combined-value.
See for more details.
Cluster members can be accessed through the items
property.
Whenever a member of the Cluster emits a value, the Cluster will emit a new combined value.
Similarly, we can group any number of Units, Systems, Actions or even Clusters together.
Try to refrain from using the static value accessor value()
method when the Cluster contains immutable Units because when calling the value()
method of a Cluster, it internally calls its members' value()
method, and if members are Immutable Units, those Units would create a clone on every call. It's not a bad thing if used intentionally, but it can add extra overhead if used too often.
The configuration options can be passed at the time of instantiation. All the configuration options are optional. Some options can also be set globally. See for more details.