mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-10 09:39:58 +00:00
prettier: Re-format .ts files
This commit is contained in:
@@ -7,8 +7,7 @@ import messaging from "../messaging";
|
||||
import options from "../lib/options";
|
||||
import bridge, { BridgeInfo } from "../lib/bridge";
|
||||
|
||||
import ReceiverSelectorManager
|
||||
from "./receiverSelector/ReceiverSelectorManager";
|
||||
import ReceiverSelectorManager from "./receiverSelector/ReceiverSelectorManager";
|
||||
|
||||
import ShimManager from "./ShimManager";
|
||||
|
||||
@@ -17,10 +16,8 @@ import receiverDevices from "./receiverDevices";
|
||||
import { initMenus } from "./menus";
|
||||
import { initWhitelist } from "./whitelist";
|
||||
|
||||
|
||||
const _ = browser.i18n.getMessage;
|
||||
|
||||
|
||||
/**
|
||||
* On install, set the default options before initializing the
|
||||
* extension. On update, handle any unset values and set to
|
||||
@@ -36,7 +33,7 @@ browser.runtime.onInstalled.addListener(async details => {
|
||||
init();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case "update": {
|
||||
// Set new defaults
|
||||
await options.update(defaultOptions);
|
||||
@@ -45,7 +42,6 @@ browser.runtime.onInstalled.addListener(async details => {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Sets up media overlay content script and handles toggling
|
||||
* on options change.
|
||||
@@ -62,10 +58,10 @@ async function initMediaOverlay() {
|
||||
|
||||
try {
|
||||
contentScript = await browser.contentScripts.register({
|
||||
allFrames: true
|
||||
, js: [{ file: "senders/media/overlay/overlayContentLoader.js" }]
|
||||
, matches: [ "<all_urls>" ]
|
||||
, runAt: "document_start"
|
||||
allFrames: true,
|
||||
js: [{ file: "senders/media/overlay/overlayContentLoader.js" }],
|
||||
matches: ["<all_urls>"],
|
||||
runAt: "document_start"
|
||||
});
|
||||
} catch (err) {
|
||||
logger.error("Failed to register media overlay");
|
||||
@@ -76,7 +72,6 @@ async function initMediaOverlay() {
|
||||
await contentScript?.unregister();
|
||||
}
|
||||
|
||||
|
||||
registerMediaOverlayContentScript();
|
||||
|
||||
// Update if toggled
|
||||
@@ -90,7 +85,6 @@ async function initMediaOverlay() {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks whether the bridge can be reached and is compatible
|
||||
* with the current version of the extension. If not, triggers
|
||||
@@ -113,10 +107,11 @@ async function notifyBridgeCompat() {
|
||||
logger.info("... bridge incompatible!");
|
||||
|
||||
const updateNotificationId = await browser.notifications.create({
|
||||
type: "basic"
|
||||
, title: `${
|
||||
_("extensionName")} — ${_("optionsBridgeIssueStatusTitle")}`
|
||||
, message: info.isVersionOlder
|
||||
type: "basic",
|
||||
title: `${_("extensionName")} — ${_(
|
||||
"optionsBridgeIssueStatusTitle"
|
||||
)}`,
|
||||
message: info.isVersionOlder
|
||||
? _("optionsBridgeOlderAction")
|
||||
: _("optionsBridgeNewerAction")
|
||||
});
|
||||
@@ -127,14 +122,12 @@ async function notifyBridgeCompat() {
|
||||
}
|
||||
|
||||
browser.tabs.create({
|
||||
url: `https://github.com/hensm/fx_cast/releases/tag/v${
|
||||
info.expectedVersion}`
|
||||
url: `https://github.com/hensm/fx_cast/releases/tag/v${info.expectedVersion}`
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
let isInitialized = false;
|
||||
|
||||
async function init() {
|
||||
@@ -163,14 +156,13 @@ async function init() {
|
||||
await initWhitelist();
|
||||
await initMediaOverlay();
|
||||
|
||||
|
||||
/**
|
||||
* When the browser action is clicked, open a receiver
|
||||
* selector and load a sender for the response. The
|
||||
* mirroring sender is loaded into the current tab at the
|
||||
* top-level frame.
|
||||
*/
|
||||
browser.browserAction.onClicked.addListener(async tab => {
|
||||
browser.browserAction.onClicked.addListener(async tab => {
|
||||
if (tab.id === undefined) {
|
||||
throw logger.error("Tab ID not found in browser action handler.");
|
||||
}
|
||||
@@ -178,9 +170,9 @@ async function init() {
|
||||
const selection = await ReceiverSelectorManager.getSelection(tab.id);
|
||||
if (selection) {
|
||||
loadSender({
|
||||
tabId: tab.id
|
||||
, frameId: 0
|
||||
, selection
|
||||
tabId: tab.id,
|
||||
frameId: 0,
|
||||
selection
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user