delete
Delete values from the tree.
keyTree.delete(keys)
Delete everything from the keyTree at the specified keys
.
Given this setup:
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 ] );
To delete a handler, use .delete
:
keyTree.delete( [ "click", "li", handler1 ] );
The keyTree
data structure will look like:
{
"click": {
"li": [ handler2 ],
"span": [ handler3 ]
}
}
To delete the remaining click
handlers:
keyTree.delete( [ "click" ] );
The keyTree
data structure will look like:
{}
Parameters
- keys
{Array}
:An array of keys to specify where to delete
Returns
{boolean}
:
If the node was found and the delete was successful.