mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-08 08:39: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;
|
||||
|
||||
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(
|
||||
new CustomEvent("deviceUp", {
|
||||
detail: { deviceInfo }
|
||||
|
||||
Reference in New Issue
Block a user