Clean up shim initialization

This commit is contained in:
hensm
2019-06-19 01:39:19 +01:00
parent 290a1facdb
commit 0a9af09419
13 changed files with 66 additions and 88 deletions

View File

@@ -0,0 +1,15 @@
"use strict";
import { onMessageResponse, sendMessage } from "./eventMessageChannel";
// Message port to background script
const backgroundPort = browser.runtime.connect({ name: "shim" });
// Forward background messages to shim
backgroundPort.onMessage.addListener(sendMessage);
// Forward shim messages to background
onMessageResponse(message => {
backgroundPort.postMessage(message);
});