aboutsummaryrefslogtreecommitdiff
path: root/src/content/client/TabsClient.ts
blob: 39348dfd8b796944f343472d398741f81acf5931 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import * as messages from '../../shared/messages';

export default interface TabsClient {
  openUrl(url: string, newTab: boolean, background?: boolean): Promise<void>;
}

export class TabsClientImpl implements TabsClient {
  async openUrl(
    url: string,
    newTab: boolean,
    background?: boolean,
  ): Promise<void> {
    await browser.runtime.sendMessage({
      type: messages.OPEN_URL,
      url,
      newTab,
      background,
    });
  }
}