From 8cdfefc0f8cc660af276739875ff44436318035e Mon Sep 17 00:00:00 2001 From: EnderDev Date: Sat, 18 Nov 2023 20:43:37 +0000 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Refactor=20history=20navig?= =?UTF-8?q?ation=20button=20to=20use=20new=20commands?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../browser-history-navigation-button.js | 36 ++----------------- 1 file changed, 3 insertions(+), 33 deletions(-) diff --git a/components/navigation/content/browser-history-navigation-button.js b/components/navigation/content/browser-history-navigation-button.js index 11c1dbe2c8..5d978462e5 100644 --- a/components/navigation/content/browser-history-navigation-button.js +++ b/components/navigation/content/browser-history-navigation-button.js @@ -9,48 +9,18 @@ constructor() { super(); - this.routineId = + this.buttonId = direction === "back" ? "navigate-back" : "navigate-forward"; + this.commandId = + direction === "back" ? "go-back" : "go-forward"; } connectedCallback() { super.connectedCallback(); - - window.addEventListener("BrowserTabs::TabSelect", this); - window.addEventListener("BrowserTabs::LocationChange", this); - window.addEventListener("load", this); - - this.disabled = true; - } - - /** - * Handles incoming events - * @param {Event & CustomEvent} event - * @returns - */ - handleEvent(event) { - switch (event.type) { - case "load": - case "BrowserTabs::LocationChange": - case "BrowserTabs::TabSelect": - // if (!this.context.browser) return; - - // if (direction === "back") { - // this.disabled = !this.context.browser.canGoBack; - // } else if (direction === "forward") { - // this.disabled = !this.context.browser.canGoForward; - // } - - // break; - } } disconnectedCallback() { super.disconnectedCallback(); - - window.removeEventListener("BrowserTabs::TabSelect", this); - window.removeEventListener("BrowserTabs::LocationChange", this); - window.removeEventListener("load", this); } };