Interface: MutatableCollector
A Collector that allows you to traverse directly into a Mutator
Extends
Properties
destroyed
destroyed:
boolean
True of the Collector has been destroyed, otherwise False.
Inherited from
elements
elements:
Element[]
All Elements the Collector has collected.
Inherited from
id
id:
string
The id of the Collector.
Inherited from
isValid
isValid:
boolean
True if all validation has been satisfied, otherwise False.
Inherited from
log
log:
MessageLog
A MessageLog scoped to this Collector.
Inherited from
name
name:
undefined|string
The name of the Collector.
Inherited from
observedTargets
observedTargets:
Element[]
All Elements the Collector is currently observing.
Inherited from
paused
paused:
boolean
True if the Collector is paused, otherwise False.
Inherited from
root
root:
Document|Element
The outermost parent Element to observe.
Inherited from
scope
scope:
undefined|string
The scope of the Collector, defined by collect.scope().
Inherited from
Methods
addListener()
addListener(
listener):this
Add an ElementListener to Collector without immediately invoking.
Parameters
| Parameter | Type | Description |
|---|---|---|
listener | ElementListener | A callback to be notified about changes in the Elements. |
Returns
this
Inherited from
as()
as(
name):MutatableCollector
Create a Collector associated with the specified name.
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | The name of the Collector to create. |
Returns
atLeast()
atLeast(
count):this
Specify the minimum number of Elements the Collector must find before it is considered valid.
Parameters
| Parameter | Type | Description |
|---|---|---|
count | number | The minimum number of Elements the Collector must match to be considered value. |
Returns
this
Inherited from
atMost()
atMost(
count):this
Specify the maximum number of Elements the Collector should find to be considered valid.
Parameters
| Parameter | Type | Description |
|---|---|---|
count | number | The maximum number of Elements the Collector must match to be considered value. |
Returns
this
Inherited from
claim()
claim():
Promise<Element>
Permanently claim a collected Element for modification.
Returns
Promise<Element>
Inherited from
destroy()
destroy():
void
Permanently destroy this Collector.
Returns
void
Inherited from
exactly()
exactly(
count):this
Specify the total number of Elements the Collector should find to be considered valid.
Parameters
| Parameter | Type | Description |
|---|---|---|
count | number | The total number of Elements the Collector must match to be considered value. |
Returns
this
Inherited from
filter()
filter(
predicate):this
Add a Predicate Elements must satisfy to be included in the Collector.
Parameters
| Parameter | Type | Description |
|---|---|---|
predicate | Predicate | A Predicate Elements must satisfy to be included in the Collector |
Returns
this
Inherited from
map()
map(
mapping):this
Map matched Elements to a new Element to be included in the Collector.
Parameters
| Parameter | Type | Description |
|---|---|---|
mapping | Mapping | A Mapping to map matched Elements to a new Element. |
Returns
this
Inherited from
mutate()
mutate(
variantKey?):Mutator
Create a Mutator associated with the current Collector.
Parameters
| Parameter | Type | Description |
|---|---|---|
variantKey? | string | The variant key to associate with the Mutator. |
Returns
notifyListeners()
notifyListeners(
elementAction,element):void
Validates the Collector and calls all attached ElementListeners
Parameters
| Parameter | Type | Description |
|---|---|---|
elementAction | EventType | The type of action of which to notify ElementListeners |
element | Element | The Element to pass to ElementListeners |
Returns
void
Inherited from
observeParent()
observeParent(
parentSelector):this
Set a selector for the parent Elements to be observed for matching Elements.
Parameters
| Parameter | Type | Description |
|---|---|---|
parentSelector | string | The selector for parent Elements. |
Returns
this
Inherited from
pause()
pause():
this
Pause collection and Element related notifications for this Collector.
Returns
this
Inherited from
subscribe()
subscribe(
listener):this
Subscribe to notifications about the changing of Elements within the Collector. Validates the Collector and immediately invokes the ElementListener when called.
Parameters
| Parameter | Type | Description |
|---|---|---|
listener | ElementListener | A callback to be notified about changes in the Elements. |
Returns
this
Inherited from
subscribeState()
subscribeState(
listener):this
Subscribe to notifications about the changing of state within the collector.
Parameters
| Parameter | Type | Description |
|---|---|---|
listener | CollectorStateListener | A callback to be notified when the state of the Collector changes. |
Returns
this
Inherited from
unpause()
unpause():
this
Unpause collection and Element related notifications for this Collector.
Returns
this
Inherited from
unsubscribe()
unsubscribe(
listener):this
Unsubscribe a previously subscribed listener from the Collector.
Parameters
| Parameter | Type | Description |
|---|---|---|
listener | ElementListener | The callback function that needs to be removed. It must match the reference of a listener previously added via subscribe. |
Returns
this
Returns the current instance to allow method chaining.
Inherited from
validate()
validate(
predicate):this
Add a Predicate that the Collector must satisfy before it is considered valid and ready to apply Effects.
Parameters
| Parameter | Type | Description |
|---|---|---|
predicate | Predicate | A Predicate the collector must meet before applying Effects. |
Returns
this
Inherited from
within()
within(
millis):this
Specify the maximum amount of time in milliseconds that a Collector has to satisfy all validation criteria.
Parameters
| Parameter | Type | Description |
|---|---|---|
millis | number | The maximum amount of time the Collector has to satisfy validation criteria. |
Returns
this