aboutsummaryrefslogtreecommitdiff
path: root/src/content/client/MarkClient.ts
blob: b7cf535048442fc63c0d298a571271c076bfce83 (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
25
26
27
28
import Mark from '../domains/Mark';
import * as messages from '../../shared/messages';

export default interface MarkClient {
  setGloablMark(key: string, mark: Mark): Promise<void>;

  jumpGlobalMark(key: string): Promise<void>;

  // eslint-disable-next-line semi
}

export class MarkClientImpl implements MarkClient {
  async setGloablMark(key: string, mark: Mark): Promise<void> {
    await browser.runtime.sendMessage({
      type: messages.MARK_SET_GLOBAL,
      key,
      x: mark.x,
      y: mark.y,
    });
  }

  async jumpGlobalMark(key: string): Promise<void> {
    await browser.runtime.sendMessage({
      type: messages.MARK_JUMP_GLOBAL,
      key,
    });
  }
}