aboutsummaryrefslogtreecommitdiff
path: root/src/background/operators/impls/NavigateRootOperator.ts
blob: b140156ce2be327759de214dbca4878fa9dadbac (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
import Operator from "../Operator";
import TabPresenter from "../../presenters/TabPresenter";

export default class NavigateRootOperator implements Operator {
  constructor(private readonly tabPresenter: TabPresenter) {}

  async run(): Promise<void> {
    const tab = await this.tabPresenter.getCurrent();
    const url = new URL(tab.url!);
    await this.tabPresenter.open(url.origin);
  }
}