diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2020-04-13 20:37:36 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2020-04-13 20:37:36 +0900 |
commit | e1dac618a8b8929f601c7ec8aca3842c5ebf9d03 (patch) | |
tree | 6a914a8243c8c02e7752a83667a54d3fa832955c /src/content/MessageListener.ts | |
parent | 685f2b7b69218b06b5bb676069e35f79c5048c9b (diff) |
Use plugin:prettier/recommended
Diffstat (limited to 'src/content/MessageListener.ts')
-rw-r--r-- | src/content/MessageListener.ts | 14 |
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); - }, + } ); } } |