mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-07 07:36:58 +00:00
Define function as member arrow function
This way it behaves as an instance method, and we don't have to pass in the object.
This commit is contained in:
@@ -8,7 +8,7 @@ export default class extends Controller {
|
||||
window.addEventListener("click", this.#hideIfClickedOutside);
|
||||
|
||||
// Close menu when making a selection
|
||||
this.contentTarget.addEventListener("click", this.#selected.bind(this));
|
||||
this.contentTarget.addEventListener("click", this.#selected);
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
@@ -19,7 +19,7 @@ export default class extends Controller {
|
||||
this.#toggleShow();
|
||||
}
|
||||
|
||||
#selected() {
|
||||
#selected = () => {
|
||||
this.contentTarget.classList.add("selected");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user