mutation-summary
Version:
Makes observing the DOM fast and easy
48 lines (47 loc) • 1.32 kB
TypeScript
/**
* A helper class that maps from a DOM Node to an arbitrary value.
*/
export declare class NodeMap<T> {
private static _ID_PROP;
private static _NEXT_ID;
private static _isIndex;
private static _nodeId;
private readonly _nodes;
private readonly _values;
/**
* Constructs a new and empty NodeMap.
*/
constructor();
/**
* Sets the value of a node within the map.
* @param node The node to set the value for.
* @param value the value to associate with the node.
*/
set(node: Node, value: T): void;
/**
* Gets the value for the given node.
*
* @param node The node to get the value of.
* @returns The value for the given node, or undefined if the node is not
* present in the map.
*/
get(node: Node): T | undefined;
/**
* Determines if a given node is in the NodeMap.
*
* @param node The node to determine if it is in the map.
*
* @returns true if the Node is contained in the map, false otherwise.
*/
has(node: Node): boolean;
/**
* Deletes a node from the NodeMap.
*
* @param node The node to delete.
*/
delete(node: Node): void;
/**
* @returns an array that holds the nodes that are the keys of the map.
*/
keys(): Node[];
}