aboutsummaryrefslogtreecommitdiff
path: root/src/content/MessageListener.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/MessageListener.ts')
-rw-r--r--src/content/MessageListener.ts14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/content/MessageListener.ts b/src/content/MessageListener.ts
index e1f7c75..3fe1dcd 100644
--- a/src/content/MessageListener.ts
+++ b/src/content/MessageListener.ts
@@ -1,14 +1,12 @@
-import { injectable } from 'tsyringe';
-import { Message, valueOf } from '../shared/messages';
+import { injectable } from "tsyringe";
+import { Message, valueOf } from "../shared/messages";
export type WebExtMessageSender = browser.runtime.MessageSender;
@injectable()
export default class MessageListener {
- onWebMessage(
- listener: (msg: Message, sender: Window) => void,
- ) {
- window.addEventListener('message', (event: MessageEvent) => {
+ onWebMessage(listener: (msg: Message, sender: Window) => void) {
+ window.addEventListener("message", (event: MessageEvent) => {
const sender = event.source;
if (!(sender instanceof Window)) {
return;
@@ -25,12 +23,12 @@ export default class MessageListener {
}
onBackgroundMessage(
- listener: (msg: Message, sender: WebExtMessageSender) => any,
+ listener: (msg: Message, sender: WebExtMessageSender) => any
) {
browser.runtime.onMessage.addListener(
(msg: any, sender: WebExtMessageSender) => {
return listener(valueOf(msg), sender);
- },
+ }
);
}
}