Skip to content

@arcmantle/chronicle / listener-affinity

listener-affinity

Functions

computeAffectedListeners()

computeAffectedListeners(root, path): Set<ChangeListener>

Defined in: listener-affinity.ts:18

Compute the set of listeners affected by a change at the given path.

Collects listeners in this order:

  • Global listeners (onAny)
  • Down listeners on the path and all ancestors (listen for descendants)
  • Exact listeners at the exact path
  • Up listeners on all descendants (listen for ancestors)

Parameters

root

object

The root object

path

string[]

The path where the change occurred

Returns

Set<ChangeListener>

Set of all affected listeners

Released under the Apache-2.0 License.