add
Add values to the tree.
keyTree.add(keys)
Adds items into the structure and returns the keyTree.
const keyTree = new KeyTree( [ Object, Object, Array ] );
function handler1() {}
function handler2() {}
function handler3() {}
keyTree.add( [ "click", "li", handler1 ] );
keyTree.add( [ "click", "li", handler2 ] );
keyTree.add( [ "click", "span", handler3 ] );
The keyTree
data structure will look like:
{
"click": {
"li": [ handler1, handler2 ],
"span": [ handler3 ]
}
}
Parameters
- keys
{Array}
:An array of keys to populate the tree
Returns
{KeyTree}
:
The keyTree.