Mark set/jump as a clean architecture
This commit is contained in:
parent
ebfb172520
commit
c6288f19d9
16 changed files with 316 additions and 137 deletions
28
src/content/client/MarkClient.ts
Normal file
28
src/content/client/MarkClient.ts
Normal file
|
@ -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,
|
||||
});
|
||||
}
|
||||
}
|
Reference in a new issue