aboutsummaryrefslogtreecommitdiff
path: root/src/content/client/FindClient.ts
blob: af0b427657e7e5b2936cdbd1c073d650727b0371 (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
import * as messages from '../../shared/messages';

export default interface FindClient {
  getGlobalLastKeyword(): Promise<string | null>;

  setGlobalLastKeyword(keyword: string): Promise<void>;
}

export class FindClientImpl implements FindClient {
  async getGlobalLastKeyword(): Promise<string | null> {
    let keyword = await browser.runtime.sendMessage({
      type: messages.FIND_GET_KEYWORD,
    });
    return keyword as string;
  }

  async setGlobalLastKeyword(keyword: string): Promise<void> {
    await browser.runtime.sendMessage({
      type: messages.FIND_SET_KEYWORD,
      keyword: keyword,
    });
  }
}