Make find as a clean architecture
This commit is contained in:
parent
bacf83a320
commit
1ba1660269
15 changed files with 424 additions and 182 deletions
30
src/content/client/ConsoleClient.ts
Normal file
30
src/content/client/ConsoleClient.ts
Normal file
|
@ -0,0 +1,30 @@
|
|||
import * as messages from '../../shared/messages';
|
||||
|
||||
export default interface ConsoleClient {
|
||||
info(text: string): Promise<void>;
|
||||
error(text: string): Promise<void>;
|
||||
|
||||
// eslint-disable-next-line semi
|
||||
}
|
||||
|
||||
export class ConsoleClientImpl implements ConsoleClient {
|
||||
async info(text: string): Promise<void> {
|
||||
await browser.runtime.sendMessage({
|
||||
type: messages.CONSOLE_FRAME_MESSAGE,
|
||||
message: {
|
||||
type: messages.CONSOLE_SHOW_INFO,
|
||||
text,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async error(text: string): Promise<void> {
|
||||
await browser.runtime.sendMessage({
|
||||
type: messages.CONSOLE_FRAME_MESSAGE,
|
||||
message: {
|
||||
type: messages.CONSOLE_SHOW_ERROR,
|
||||
text,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
Reference in a new issue