From f26ac80aa50d9ccb36c9f4a390936abf566c9459 Mon Sep 17 00:00:00 2001 From: Amaury Date: Tue, 6 Jul 2021 15:32:47 +0200 Subject: [PATCH] adapted to listener-rss v 0.0.3 --- src/main.ts | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/main.ts b/src/main.ts index 58303d9..edcbdf8 100644 --- a/src/main.ts +++ b/src/main.ts @@ -47,16 +47,10 @@ async function register({ }); myManager.on('newEntries', (entries: any) => { - if (firstUpdate) { - logger.warn('Premiere update'); + const datas = listenersDataBinding.get(entries.addressListener); + if (!datas) return; - firstUpdate = false; - return; - } - - logger.warn( - 'Nouvelles baba entrées détéctées: ' + JSON.stringify(entries) - ); + logger.warn('Nouvelles entrées détéctées: ' + JSON.stringify(entries)); }); } @@ -68,13 +62,17 @@ async function addListeners(listenerInput: string) { logger.warn('Erreur: malformé'); return; } - let newListeners = listeners.filter(item => !listenersDataBinding.has(item.address)); - let removedUrls = Array.from(listenersDataBinding.keys()).filter(url => !listeners.some(listener => listener.url === url)); + let newListeners = listeners.filter( + (item) => !listenersDataBinding.has(item.address) + ); + let removedUrls = Array.from(listenersDataBinding.keys()).filter( + (url) => !listeners.some((listener) => listener.address === url) + ); for (const newItem of newListeners) { listenersDataBinding.set(newItem.address, { ChannelId: newItem.ChannelId, - firstUpdate: newItem.firstUpdate, + firstUpdate: true, address: newItem.address, }); }