// back and forward are the browser's own history. where the navigation api says there's
// nowhere to go they're disabled, elsewhere they stay on and do nothing past the ends.

const back = document.querySelector<HTMLButtonElement>("[data-back]");
const forward = document.querySelector<HTMLButtonElement>("[data-forward]");
const nav = (window as unknown as { navigation?: { canGoBack: boolean; canGoForward: boolean } }).navigation;

back?.addEventListener("click", () => history.back());
forward?.addEventListener("click", () => history.forward());
if (nav && back && forward) {
  back.disabled = !nav.canGoBack;
  forward.disabled = !nav.canGoForward;
}

export {};
