mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-11 10:09:59 +00:00
Move some background modules to a separate folder and fix init order
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
import { stringify } from "./utils";
|
||||
|
||||
import { ReceiverSelection
|
||||
, ReceiverSelectorMediaType } from "../receiver_selectors";
|
||||
, ReceiverSelectorMediaType } from "../background/receiverSelector";
|
||||
|
||||
|
||||
interface LoadSenderOptions {
|
||||
|
||||
@@ -6,7 +6,7 @@ import { Message } from "../types";
|
||||
const WEBSOCKET_DAEMON_URL = "ws://localhost:9556";
|
||||
|
||||
|
||||
type DisconnectListener = (port: browser.runtime.Port) => void;;
|
||||
type DisconnectListener = (port: browser.runtime.Port) => void;
|
||||
type MessageListener = (message: any) => void;
|
||||
|
||||
function connectNative (application: string) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import defaultOptions from "../defaultOptions";
|
||||
|
||||
import { ReceiverSelectorType } from "../receiver_selectors/";
|
||||
import { ReceiverSelectorType } from "../background/receiverSelector";
|
||||
import { Message } from "../types";
|
||||
import { TypedEventTarget } from "./typedEvents";
|
||||
|
||||
@@ -16,13 +16,13 @@ export interface Options {
|
||||
localMediaServerPort: number;
|
||||
mirroringEnabled: boolean;
|
||||
mirroringAppId: string;
|
||||
receiverSelectorType: ReceiverSelectorType.Popup;
|
||||
receiverSelectorType: ReceiverSelectorType;
|
||||
receiverSelectorCloseIfFocusLost: boolean;
|
||||
receiverSelectorWaitForConnection: boolean;
|
||||
userAgentWhitelistEnabled: boolean;
|
||||
userAgentWhitelist: string[];
|
||||
|
||||
[key: string]: Options[keyof Options]
|
||||
[key: string]: Options[keyof Options];
|
||||
}
|
||||
|
||||
|
||||
@@ -49,28 +49,30 @@ export default new class extends TypedEventTarget<EventMap> {
|
||||
const { oldValue, newValue } = _changes.options;
|
||||
const changedKeys = [];
|
||||
|
||||
for (const key in newValue) {
|
||||
// Don't track added keys
|
||||
if (!(key in oldValue)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const oldKeyValue = oldValue[key];
|
||||
const newKeyValue = newValue[key];
|
||||
|
||||
// Equality comparison
|
||||
if (oldKeyValue === newKeyValue) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Array comparison
|
||||
if (oldKeyValue instanceof Array
|
||||
&& newKeyValue instanceof Array) {
|
||||
if (oldKeyValue.length === newKeyValue.length
|
||||
&& oldKeyValue.every((value, index) =>
|
||||
value === newKeyValue[index])) {
|
||||
for (const key of Object.keys(newValue)) {
|
||||
if (oldValue) {
|
||||
// Don't track added keys
|
||||
if (!(key in oldValue)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const oldKeyValue = oldValue[key];
|
||||
const newKeyValue = newValue[key];
|
||||
|
||||
// Equality comparison
|
||||
if (oldKeyValue === newKeyValue) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Array comparison
|
||||
if (oldKeyValue instanceof Array
|
||||
&& newKeyValue instanceof Array) {
|
||||
if (oldKeyValue.length === newKeyValue.length
|
||||
&& oldKeyValue.every((value, index) =>
|
||||
value === newKeyValue[index])) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
changedKeys.push(key);
|
||||
|
||||
Reference in New Issue
Block a user