mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-11 10:09:59 +00:00
Ensure receiver devices are consistently sorted
This commit is contained in:
@@ -138,6 +138,14 @@ export default new (class extends TypedEventTarget<EventMap> {
|
|||||||
const { deviceId, deviceInfo } = message.data;
|
const { deviceId, deviceInfo } = message.data;
|
||||||
|
|
||||||
this.receiverDevices.set(deviceId, deviceInfo);
|
this.receiverDevices.set(deviceId, deviceInfo);
|
||||||
|
|
||||||
|
// Sort devices by friendly name
|
||||||
|
this.receiverDevices = new Map(
|
||||||
|
[...this.receiverDevices].sort(([, deviceA], [, deviceB]) =>
|
||||||
|
deviceA.friendlyName.localeCompare(deviceB.friendlyName)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
this.dispatchEvent(
|
this.dispatchEvent(
|
||||||
new CustomEvent("deviceUp", {
|
new CustomEvent("deviceUp", {
|
||||||
detail: { deviceInfo }
|
detail: { deviceInfo }
|
||||||
|
|||||||
Reference in New Issue
Block a user