Add webcomponents polyfill and load official framework API script

This commit is contained in:
hensm
2019-03-20 20:26:30 +00:00
parent 04bf7a209d
commit 2a327573da
5 changed files with 303 additions and 9 deletions

View File

@@ -3,6 +3,15 @@
import { Message } from "../types";
import { onMessageResponse, sendMessage } from "./messageBridge";
if ((window as any)._isFramework) {
const polyfillScriptElement = document.createElement("script");
polyfillScriptElement.src = browser.runtime.getURL(
"vendor/webcomponents-lite.js")
document.head.append(polyfillScriptElement);
}
// Message ports
const backgroundPort = browser.runtime.connect({ name: "shim" });
let popupPort: browser.runtime.Port;