Skip to main content

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​

Collector.destroyed


elements​

elements: Element[]

All Elements the Collector has collected.

Inherited from​

Collector.elements


id​

id: string

The id of the Collector.

Inherited from​

Collector.id


isValid​

isValid: boolean

True if all validation has been satisfied, otherwise False.

Inherited from​

Collector.isValid


log​

log: MessageLog

A MessageLog scoped to this Collector.

Inherited from​

Collector.log


loopGuard​

loopGuard: LoopGuardOptions

Options for LoopGuard to catch infinite loops

Inherited from​

Collector.loopGuard


name​

name: string | undefined

The name of the Collector.

Inherited from​

Collector.name


observedTargets​

observedTargets: Element[]

All Elements the Collector is currently observing.

Inherited from​

Collector.observedTargets


paused​

paused: boolean

True if the Collector is paused, otherwise False.

Inherited from​

Collector.paused


root​

root: Document | Element

The outermost parent Element to observe.

Inherited from​

Collector.root


scope​

scope: string | undefined

The scope of the Collector, defined by collect.scope().

Inherited from​

Collector.scope


selector?​

optional selector: SelectorType

The selector or subject used to seed the collector.

Inherited from​

Collector.selector

Methods​

addListener()​

addListener(listener): this

Add an ElementListener to Collector without immediately invoking.

Parameters​

ParameterTypeDescription
listenerElementListenerA callback to be notified about changes in the Elements.

Returns​

this

Inherited from​

Collector.addListener


as()​

as(name): MutatableCollector

Create a Collector associated with the specified name.

Parameters​

ParameterTypeDescription
namestringThe name of the Collector to create.

Returns​

MutatableCollector


atLeast()​

atLeast(count): this

Specify the minimum number of Elements the Collector must find before it is considered valid.

Parameters​

ParameterTypeDescription
countnumberThe minimum number of Elements the Collector must match to be considered value.

Returns​

this

Inherited from​

Collector.atLeast


atMost()​

atMost(count): this

Specify the maximum number of Elements the Collector should find to be considered valid.

Parameters​

ParameterTypeDescription
countnumberThe maximum number of Elements the Collector must match to be considered value.

Returns​

this

Inherited from​

Collector.atMost


claim()​

claim(): Promise<Element>

Permanently claim a collected Element for modification.

Returns​

Promise<Element>

Inherited from​

Collector.claim


destroy()​

destroy(): void

Permanently destroy this Collector.

Returns​

void

Inherited from​

Collector.destroy


exactly()​

exactly(count): this

Specify the total number of Elements the Collector should find to be considered valid.

Parameters​

ParameterTypeDescription
countnumberThe total number of Elements the Collector must match to be considered value.

Returns​

this

Inherited from​

Collector.exactly


filter()​

filter(predicate): this

Add a Predicate Elements must satisfy to be included in the Collector.

Parameters​

ParameterTypeDescription
predicatePredicateA Predicate Elements must satisfy to be included in the Collector

Returns​

this

Inherited from​

Collector.filter


map()​

map(mapping): this

Map matched Elements to a new Element to be included in the Collector.

Parameters​

ParameterTypeDescription
mappingMappingA Mapping to map matched Elements to a new Element.

Returns​

this

Inherited from​

Collector.map


mutate()​

mutate(variantKey?): Mutator

Create a Mutator associated with the current Collector.

Parameters​

ParameterTypeDescription
variantKey?stringThe variant key to associate with the Mutator.

Returns​

Mutator


notifyListeners()​

notifyListeners(elementAction, element): void

Validates the Collector and calls all attached ElementListeners

Parameters​

ParameterTypeDescription
elementActionEventTypeThe type of action of which to notify ElementListeners
elementElementThe Element to pass to ElementListeners

Returns​

void

Inherited from​

Collector.notifyListeners


observeParent()​

observeParent(parentSelector): this

Set a selector for the parent Elements to be observed for matching Elements.

Parameters​

ParameterTypeDescription
parentSelectorstringThe selector for parent Elements.

Returns​

this

Inherited from​

Collector.observeParent


pause()​

pause(): this

Pause collection and Element related notifications for this Collector.

Returns​

this

Inherited from​

Collector.pause


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​

ParameterTypeDescription
listenerElementListenerA callback to be notified about changes in the Elements.

Returns​

this

Inherited from​

Collector.subscribe


subscribeState()​

subscribeState(listener): this

Subscribe to notifications about the changing of state within the collector.

Parameters​

ParameterTypeDescription
listenerCollectorStateListenerA callback to be notified when the state of the Collector changes.

Returns​

this

Inherited from​

Collector.subscribeState


unpause()​

unpause(): this

Unpause collection and Element related notifications for this Collector.

Returns​

this

Inherited from​

Collector.unpause


unsubscribe()​

unsubscribe(listener): this

Unsubscribe a previously subscribed listener from the Collector.

Parameters​

ParameterTypeDescription
listenerElementListenerThe 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​

Collector.unsubscribe


validate()​

validate(predicate): this

Add a Predicate that the Collector must satisfy before it is considered valid and ready to apply Effects.

Parameters​

ParameterTypeDescription
predicatePredicateA Predicate the collector must meet before applying Effects.

Returns​

this

Inherited from​

Collector.validate


within()​

within(millis): this

Specify the maximum amount of time in milliseconds that a Collector has to satisfy all validation criteria.

Parameters​

ParameterTypeDescription
millisnumberThe maximum amount of time the Collector has to satisfy validation criteria.

Returns​

this

Inherited from​

Collector.within