Remove name field adding lastentries parameter and give the new entries for the first update

This commit is contained in:
2021-03-21 21:35:22 +01:00
parent f919726e4d
commit ce1d8f4ab6
4 changed files with 7 additions and 19 deletions

View File

@ -1,6 +1,6 @@
export interface ListenerRSSInfos {
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
readonly lastEntriesLinks?: [string]; // links from lastentries
}

View File

@ -1,2 +0,0 @@
export { ListenerRss } from "./listener-rss";
export { ListenerRSSInfos } from "./Models/ListenerRSSInfos";

View File

@ -27,11 +27,12 @@ export class ListenerRss extends EventEmitter {
constructor(config: ListenerInfo) {
super();
this.name = config.name;
this.address = config.address;
this.timeloop =
config.timeloop === undefined ? DEFAULT_TIMELOOP : config.timeloop;
this.customfields = config.customfields;
this.lastEntriesLinks =
config.lastEntriesLinks === undefined ? [] : config.lastEntriesLinks;
this.parser = this.generateParser();
}
@ -78,7 +79,7 @@ export class ListenerRss extends EventEmitter {
!this.lastEntriesLinks.includes(item.link)
);
if (this.lastEntriesLinks.length !== 0 && newEntries.length !== 0) {
if (newEntries.length !== 0) {
this.emit("newEntries", newEntries);
}
this.lastEntriesLinks = updatedEntriesLinks;