Pre-bind methods
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user