Skip to content

Commit

Permalink
♻️ Refactor history navigation button to use new commands
Browse files Browse the repository at this point in the history
  • Loading branch information
kierandrewett committed Nov 18, 2023
1 parent eb8dd36 commit 8cdfefc
Showing 1 changed file with 3 additions and 33 deletions.
36 changes: 3 additions & 33 deletions components/navigation/content/browser-history-navigation-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};

Expand Down

0 comments on commit 8cdfefc

Please sign in to comment.