KeyTreeCallbacks
Defines callbacks onFirst
and/or onEmpty
.
Object
Defines callbacks onFirst
and/or onEmpty
.
const keyTreeCallbacks = {
onFirst: function() {
// called when the first node is added
},
onEmpty: function() {
// called when all nodes are removed
}
};
const keyTree = new KeyTree( [ Object, Object, Array ], keyTreeCallbacks );
function handler1() {}
keyTree.add( [ "click", "li", handler1 ] );
// onFirst is called with a context (`this`) of the keyTree instance and no arguments
keyTree.delete( [] );
// onEmpty is called with a context (`this`) of the keyTree instance and no arguments