diff --git a/src/listener-rss.ts b/src/listener-rss.ts index 3dcddb4..4e8dcb7 100644 --- a/src/listener-rss.ts +++ b/src/listener-rss.ts @@ -23,9 +23,10 @@ class ListenerRss extends EventEmitter { customfields?: { [key: string]: string[] | string }; // private fields - parser: Parser; - loopRunning: boolean = false; - lastEntriesLinks: string[] = []; + private parser: Parser; + private loopRunning: boolean = false; + private lastEntriesLinks: string[] = []; + private firstUpdate = true; /** * @brief constructor @@ -89,10 +90,12 @@ class ListenerRss extends EventEmitter { !this.lastEntriesLinks.includes(item.link) ); - if (newEntries.length !== 0) { - this.emit("newEntries", newEntries); - } this.lastEntriesLinks = updatedEntriesLinks; + + if (this.firstUpdate && newEntries.length !== 0) + this.emit("newEntries", newEntries); + + this.firstUpdate = false; }) .catch((err) => this.emit("error", err)) );