mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-08 08:39:59 +00:00
Remove popup deviceStore
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
import { hasRequiredCapabilities } from "../../cast/utils";
|
||||
|
||||
import Receiver from "./Receiver.svelte";
|
||||
import deviceStore from "./deviceStore";
|
||||
|
||||
const _ = browser.i18n.getMessage;
|
||||
|
||||
@@ -25,6 +24,9 @@
|
||||
/** Media types available to select. */
|
||||
let availableMediaTypes = ReceiverSelectorMediaType.App;
|
||||
|
||||
/** Devices to display. */
|
||||
let devices: ReceiverDevice[] = [];
|
||||
|
||||
/** Sender app ID (if available). */
|
||||
let appId: Optional<string>;
|
||||
/** Page info (if launched from page context). */
|
||||
@@ -166,7 +168,7 @@
|
||||
|
||||
updateKnownApp();
|
||||
|
||||
$deviceStore = message.data.receiverDevices;
|
||||
devices = message.data.receiverDevices;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -267,7 +269,7 @@
|
||||
|
||||
// Match by index rendered receiver element to device array
|
||||
if (receiverElementIndex > -1) {
|
||||
return $deviceStore[receiverElementIndex];
|
||||
return devices[receiverElementIndex];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -418,12 +420,12 @@
|
||||
{/if}
|
||||
|
||||
<ul class="receiver-list">
|
||||
{#if !$deviceStore.length}
|
||||
{#if !devices.length}
|
||||
<div class="receiver-list__not-found">
|
||||
{_("popupNoReceiversFound")}
|
||||
</div>
|
||||
{:else}
|
||||
{#each $deviceStore as device}
|
||||
{#each devices as device}
|
||||
<Receiver
|
||||
{port}
|
||||
{device}
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
<button
|
||||
type="button"
|
||||
class="receiver__expand-button ghost"
|
||||
class:receiver__expand-button--expanded={isExpanded}
|
||||
class:receiver__expand-button--expanded={isExpanded && mediaStatus}
|
||||
title={_("popupShowDetailsTitle")}
|
||||
disabled={!mediaStatus}
|
||||
on:click={() => {
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
|
||||
const _ = browser.i18n.getMessage;
|
||||
|
||||
import deviceStore from "./deviceStore";
|
||||
|
||||
const dispatch = createEventDispatcher<{
|
||||
togglePlayback: void;
|
||||
seek: { position: number };
|
||||
@@ -104,13 +102,10 @@
|
||||
let lastUpdateTime = 0;
|
||||
let currentTime = getEstimatedMediaTime();
|
||||
|
||||
deviceStore.subscribe(devices => {
|
||||
const newDevice = devices.find(newDevice => newDevice.id === device.id);
|
||||
if (newDevice?.mediaStatus?.currentTime) {
|
||||
lastUpdateTime = Date.now();
|
||||
currentTime = newDevice.mediaStatus.currentTime;
|
||||
}
|
||||
});
|
||||
$: if (device.mediaStatus?.currentTime) {
|
||||
lastUpdateTime = 0;
|
||||
currentTime = device.mediaStatus.currentTime;
|
||||
}
|
||||
|
||||
// Update estimated time every second
|
||||
onMount(() => {
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
import { writable } from "svelte/store";
|
||||
import type { ReceiverDevice } from "../../types";
|
||||
|
||||
export default writable<ReceiverDevice[]>([]);
|
||||
Reference in New Issue
Block a user