Change signature of customFields and make ListenerRSSInfos properties ro
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
export interface ListenerRSSInfos {
|
||||
name: string; // name of the listener
|
||||
address: string; // feed's address
|
||||
timeloop?: number; // update time RSS feed
|
||||
customfields?: [string, string | [string, string]][]; // rss fields custom
|
||||
readonly name: string; // name of the listener
|
||||
readonly address: string; // feed's address
|
||||
readonly timeloop?: number; // update time RSS feed
|
||||
readonly customfields?: { [key: string]: string | string[] }; // rss fields custom
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ export class ListenerRss {
|
||||
name: string = "";
|
||||
address: string = "";
|
||||
timeloop: number = DEFAULT_TIMELOOP; // time in seconds
|
||||
customfields?: [string, string | [string, string]][];
|
||||
customfields?: { [key: string]: string[] | string };
|
||||
|
||||
// private fields
|
||||
parser: Parser | undefined = undefined;
|
||||
@ -24,8 +24,8 @@ export class ListenerRss {
|
||||
this.customfields !== undefined
|
||||
? {
|
||||
customFields: {
|
||||
item: this.customfields.map((elt) => {
|
||||
return Array.isArray(elt[1]) ? elt[1][0] : elt[1];
|
||||
item: Object.entries(this.customfields).map(([, value]) => {
|
||||
return Array.isArray(value[1]) ? value[1][0] : value[1];
|
||||
}),
|
||||
},
|
||||
}
|
||||
@ -39,8 +39,7 @@ export class ListenerRss {
|
||||
this.address = infos.address;
|
||||
this.timeloop =
|
||||
infos.timeloop === undefined ? DEFAULT_TIMELOOP : infos.timeloop;
|
||||
this.customfields =
|
||||
infos.customfields === undefined ? undefined : infos.customfields;
|
||||
this.customfields = infos.customfields;
|
||||
}
|
||||
|
||||
fetchRSS(): any {
|
||||
|
Reference in New Issue
Block a user