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

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

  // eslint-disable-next-line semi
}

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,
    });
  }
}