mirror of
https://github.com/salexdv/bsl_console.git
synced 2024-11-28 08:48:48 +02:00
tree dispose
This commit is contained in:
parent
253b75a171
commit
31f5e72b2b
@ -1,17 +1,19 @@
|
|||||||
class Treeview {
|
class Treeview {
|
||||||
constructor(treeviewId, editor, imageBase) {
|
constructor(treeviewId, editor, imageBase) {
|
||||||
|
let self = this;
|
||||||
this.treeviewId = treeviewId;
|
this.treeviewId = treeviewId;
|
||||||
this.editor = editor;
|
this.editor = editor;
|
||||||
this.selected = null;
|
this.selected = null;
|
||||||
this.imageBase = imageBase;
|
this.imageBase = imageBase;
|
||||||
document.querySelector(this.treeviewId).addEventListener("click", (event) => {
|
this.clickListener = function(event) {
|
||||||
this.on("click", event);
|
self.on("click", event);
|
||||||
});
|
}
|
||||||
document.querySelector(this.treeviewId)
|
document.querySelector(this.treeviewId).addEventListener("click", this.clickListener);
|
||||||
};
|
};
|
||||||
on(eventName, eventData) {
|
on(eventName, eventData) {
|
||||||
switch (eventName) {
|
switch (eventName) {
|
||||||
case "click": {
|
case "click": {
|
||||||
|
console.log(eventData);
|
||||||
if (eventData.target.tagName == 'A') {
|
if (eventData.target.tagName == 'A') {
|
||||||
eventData.preventDefault();
|
eventData.preventDefault();
|
||||||
let element = eventData.target;
|
let element = eventData.target;
|
||||||
@ -106,6 +108,7 @@ class Treeview {
|
|||||||
document.getElementById(id).click();
|
document.getElementById(id).click();
|
||||||
};
|
};
|
||||||
dispose() {
|
dispose() {
|
||||||
|
document.querySelector(this.treeviewId).removeEventListener("click", this.clickListener);
|
||||||
document.querySelector(this.treeviewId).innerHTML = '';
|
document.querySelector(this.treeviewId).innerHTML = '';
|
||||||
};
|
};
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user