Implement EventListener instead of func juggling

This commit is contained in:
2025-10-09 11:35:35 +02:00
parent 46e7f7540b
commit 10a19717ad
4 changed files with 18 additions and 17 deletions

View File

@@ -26,7 +26,7 @@ class trtorrent {
this.#servers[srv] = status;
}
#handler = function(e) {
handleEvent(e) {
switch (e.type) {
case 'click':
if (e.currentTarget.hasAttributeNS('trweb', 'torrentlistfield')) {
@@ -39,7 +39,7 @@ class trtorrent {
}
break;
}
}.bind(this);
}
constructor(hash) {
this.#hash = hash;
@@ -52,7 +52,7 @@ class trtorrent {
this.#element.torrent = this;
this.#element.classList.add('trweb_torrentlistentry', 'trweb_hide_buttons', 'row');
this.#element.setAttributeNS('trweb', 'torrentlistfield', 'entry');
this.#element.addEventListener('click', this.#handler);
this.#element.addEventListener('click', this);
this.#element.element_name = element_name;
this.#element.appendChild(element_name);
}