aboutsummaryrefslogtreecommitdiff
path: root/src/content/client/MarkClient.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/client/MarkClient.ts')
-rw-r--r--src/content/client/MarkClient.ts28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/content/client/MarkClient.ts b/src/content/client/MarkClient.ts
new file mode 100644
index 0000000..b7cf535
--- /dev/null
+++ b/src/content/client/MarkClient.ts
@@ -0,0 +1,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,
+ });
+ }
+}