Created
August 21, 2018 21:50
-
-
Save nvandoorn/7e4b43d18cbc5a4979b38878afd5d03c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class StatsProvider { | |
private getSwitchedCellStrength(): Observable<number> { | |
return this.switch$ | |
.switchMap((deviceId: string) => | |
this.db | |
.list(this.paths.sensorStatList(deviceId, CELL_STRENGTH_KEY), { | |
query: { | |
orderByChild: 'datetime', | |
limitToLast: 1 | |
} | |
}) | |
.takeUntil(this.device.deviceChange$) | |
) | |
.filter((stats: Stat<any>[]) => stats != null) | |
.filter(stats => stats[0]) | |
.map((stats): number => stats[0].val) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment