refactor: extend store with current epg program field

This commit is contained in:
4gray committed 2021-07-05 18:45:04 +02:00
1 parent 9f5014021c
commit 0116a63823
2 files changed
+15

No files matched your search

+13
View File
@@ -9,6 +9,7 @@ import { EpgProgram } from '../player/models/epg-program.model';
export interface ChannelState extends EntityState<Channel> {
active: Channel;
epgAvailable: boolean;
currentEpgProgram: EpgProgram;
favorites: string[];
playlistId: string;
}
@@ -23,6 +24,7 @@ export class ChannelStore extends EntityStore<ChannelState> {
constructor(private electronService: ElectronService) {
super({
active: undefined,
currentEpgProgram: undefined,
epgAvailable: false,
favorites: [],
playlistId: '',
@@ -123,4 +125,15 @@ export class ChannelStore extends EntityStore<ChannelState> {
};
});
}
/**
* Updates the active epg program for the active channel
* @param currentEpgProgram program to set
*/
setCurrentEpgProgram(currentEpgProgram: EpgProgram): void {
this.update((store) => ({
...store,
currentEpgProgram,
}));
}
}