Class EventListenerTree

Construct a tree root when invoked without any arguments. Children nodes are constructred internally as needed on calls to addListener()

Param: parent

Param: segment

Constructors

  • Parameters

    • Optional parent: any
    • Optional segment: string

    Returns EventListenerTree

Properties

children: any
listeners: any
parent?: any
segment?: string

Methods

  • Add a listener to a path location. Listener should be unique per path location, and calling twice with the same segments and listener value has no effect. Unlike EventEmitter, listener may be any type of value

    Parameters

    Returns this

  • Remove the reference to this node from its parent so that it can be garbage collected. This is called internally when all listeners to a node are removed

    Returns void

  • Return an array with each of the listeners that may be affected by a change to segments. These are:

    1. Listeners to each node from the root to the node for segments
    2. Listeners to all descendent nodes under segments

    Parameters

    Returns any[]

    listeners

  • Return an array with each of the listeners to descendent nodes, not including listeners to segments itself

    Parameters

    Returns any[]

    listeners

  • Return direct listeners to segments

    Parameters

    Returns any

    listeners

  • Return an array with each of the listeners to descendent nodes, not including listeners to this node itself

    Returns any[]

    listeners

  • Return an array with each of the listeners to segments, including treating wildcard segments ('*') and remainder segments ('**') as matches

    Parameters

    Returns any[]

    listeners

  • Remove all listeners and descendent listeners for a path location

    Parameters

    Returns void

  • Remove a listener from a path location

    Parameters

    Returns void

  • Remove a listener from the current node

    Parameters

    • listener: any

    Returns void