This repository has been archived on 2020-04-04. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
Vim-Vixen/src/content/client/ConsoleClient.ts
2019-05-22 20:30:20 +09:00

28 lines
678 B
TypeScript

import * as messages from '../../shared/messages';
export default interface ConsoleClient {
info(text: string): Promise<void>;
error(text: string): Promise<void>;
}
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,
},
});
}
}