import { type Segments } from '../types'; /** * Construct a tree root when invoked without any arguments. Children nodes are * constructred internally as needed on calls to addListener() * * @param {EventListenerTree} [parent] * @param {string} [segment] */ export declare class EventListenerTree { parent?: any; segment?: string; children: any; listeners: any; constructor(parent?: any, segment?: string); /** * 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 */ destroy(): void; /** * Get a node for a path if it exists * * @param {string[]} segments * @return {EventListenerTree|undefined} */ _getChild(segments: Segments): this; /** * If a path already has a node, return it. Otherwise, create the node and * ancestors in a lazy manner. Return the node for the path * * @param {string[]} segments * @return {EventListenerTree} */ _getOrCreateChild(segments: Segments): this; /** * 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 * * @param {string[]} segments * @param {*} listener * @return {EventListenerTree} */ addListener(segments: Segments, listener: any): this; /** * Remove a listener from a path location * * @param {string[]} segments * @param {*} listener */ removeListener(segments: Segments, listener: any): void; /** * Remove a listener from the current node * * @param {*} listener */ removeOwnListener(listener: any): void; /** * Remove all listeners and descendent listeners for a path location * * @param {string[]} segments */ removeAllListeners(segments: Segments): void; /** * Return direct listeners to `segments` * * @param {string[]} segments * @return {Array} listeners */ getListeners(segments: Segments): any; /** * 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` * * @param {string[]} segments * @return {Array} listeners */ getAffectedListeners(segments: Segments): any[]; /** * Return an array with each of the listeners to descendent nodes, not * including listeners to `segments` itself * * @param {string[]} segments * @return {Array} listeners */ getDescendantListeners(segments: Segments): any[]; /** * Return an array with each of the listeners to descendent nodes, not * including listeners to this node itself * * @return {Array} listeners */ getOwnDescendantListeners(): any[]; /** * Return an array with each of the listeners to `segments`, including * treating wildcard segments ('*') and remainder segments ('**') as matches * * @param {string[]} segments * @return {Array} listeners */ getWildcardListeners(segments: Segments): any[]; }