mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-12 10:39:57 +00:00
Add options checks for waitForConnection and closeIfFocusLost
This commit is contained in:
@@ -4,6 +4,8 @@ import ReceiverSelector, {
|
||||
ReceiverSelectorEvents
|
||||
, ReceiverSelectorMediaType } from "./ReceiverSelector";
|
||||
|
||||
import options from "../lib/options";
|
||||
|
||||
import { TypedEventTarget } from "../lib/typedEvents";
|
||||
import { getWindowCenteredProps } from "../lib/utils";
|
||||
import { Message, Receiver } from "../types";
|
||||
@@ -107,9 +109,15 @@ export default class PopupReceiverSelector
|
||||
...centeredProps
|
||||
});
|
||||
|
||||
// Add focus listener
|
||||
browser.windows.onFocusChanged.addListener(
|
||||
this.onWindowsFocusChanged);
|
||||
|
||||
const closeIfFocusLost = await options.get(
|
||||
"receiverSelectorCloseIfFocusLost");
|
||||
|
||||
if (closeIfFocusLost) {
|
||||
// Add focus listener
|
||||
browser.windows.onFocusChanged.addListener(
|
||||
this.onWindowsFocusChanged);
|
||||
}
|
||||
}
|
||||
|
||||
public async close (): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user