Pre-bind methods

This commit is contained in:
2025-10-09 10:27:23 +02:00
parent b17ecb2961
commit 46e7f7540b
3 changed files with 22 additions and 22 deletions

View File

@@ -26,7 +26,7 @@ class trtorrent {
this.#servers[srv] = status;
}
#handler(e) {
#handler = function(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.bind(this));
this.#element.addEventListener('click', this.#handler);
this.#element.element_name = element_name;
this.#element.appendChild(element_name);
}