blob: 6bf513ba3102e2f092432ca01a0a3582418d45f8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
import Operator from "../Operator";
import WindowPresenter from "../../presenters/WindowPresenter";
import TabPresenter from "../../presenters/TabPresenter";
export default class InternalOpenURLOperator implements Operator {
constructor(
private readonly windowPresenter: WindowPresenter,
private readonly tabPresenter: TabPresenter,
private readonly url: string,
private readonly newTab?: boolean,
private readonly newWindow?: boolean
) {}
async run(): Promise<void> {
if (this.newWindow) {
await this.windowPresenter.create(this.url);
} else if (this.newTab) {
await this.tabPresenter.create(this.url);
} else {
const tab = await this.tabPresenter.getCurrent();
await this.tabPresenter.open(this.url, tab.id);
}
}
}
|