Remove name field adding lastentries parameter and give the new entries for the first update
This commit is contained in:
@ -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
|
||||
}
|
||||
|
@ -1,2 +0,0 @@
|
||||
export { ListenerRss } from "./listener-rss";
|
||||
export { ListenerRSSInfos } from "./Models/ListenerRSSInfos";
|
@ -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;
|
||||
|
Reference in New Issue
Block a user