Fold map operation into combineLatest
This commit is contained in:
@@ -269,21 +269,21 @@ class ControlledAudioOutput
|
|||||||
this.deviceSelection$.next(id);
|
this.deviceSelection$.next(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public readonly selected$ = combineLatest([
|
public readonly selected$ = combineLatest(
|
||||||
this.available$,
|
[
|
||||||
merge(
|
this.available$,
|
||||||
controlledOutputSelection$.pipe(startWith(undefined)),
|
merge(
|
||||||
this.deviceSelection$,
|
controlledOutputSelection$.pipe(startWith(undefined)),
|
||||||
),
|
this.deviceSelection$,
|
||||||
]).pipe(
|
),
|
||||||
map(([available, selectId]) => {
|
],
|
||||||
|
(available, selectId) => {
|
||||||
const id = selectId ?? available.keys().next().value;
|
const id = selectId ?? available.keys().next().value;
|
||||||
return id
|
return id
|
||||||
? { id, virtualEarpiece: id === EARPIECE_CONFIG_ID }
|
? { id, virtualEarpiece: id === EARPIECE_CONFIG_ID }
|
||||||
: undefined;
|
: undefined;
|
||||||
}),
|
},
|
||||||
this.scope.state(),
|
).pipe(this.scope.state());
|
||||||
);
|
|
||||||
|
|
||||||
public constructor(private readonly scope: ObservableScope) {
|
public constructor(private readonly scope: ObservableScope) {
|
||||||
this.selected$.subscribe((device) => {
|
this.selected$.subscribe((device) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user