Add typed messaging

This commit is contained in:
hensm
2020-02-18 07:37:20 +00:00
parent 652fd21f77
commit 2eeaff4c15
19 changed files with 431 additions and 227 deletions

View File

@@ -2,14 +2,22 @@
import semver from "semver";
import { TypedPort } from "./TypedPort";
import logger from "./logger";
import { Messages, Message, Port } from "./messaging";
import nativeMessaging from "./nativeMessaging";
import options from "./options";
import { Receiver } from "../types";
import { ReceiverSelectionCast
, ReceiverSelectionStop } from "../background/receiverSelector/ReceiverSelector";
async function connect (): Promise<browser.runtime.Port> {
async function connect (): Promise<Port> {
const applicationName = await options.get("bridgeApplicationName");
const bridgePort = nativeMessaging.connectNative(applicationName);
const bridgePort = nativeMessaging.connectNative(applicationName) as
unknown as Port;
bridgePort.onDisconnect.addListener(() => {
if (bridgePort.error) {