From 3a221a0e93159f9a63e512b50e07b874ba85e1e1 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Thu, 13 Oct 2022 00:56:53 -0400 Subject: [PATCH] Only periodically refresh in wall-display mode --- src/common.ts | 8 +------- src/wall-display.ts | 10 +++++++++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/common.ts b/src/common.ts index f803e8c..cd907a8 100644 --- a/src/common.ts +++ b/src/common.ts @@ -133,11 +133,5 @@ export function main( calendar.render(); - function refresh() { - calendar.refetchEvents(); - calendar.today(); - } - - // refresh data every five minutes - window.setInterval(refresh, 5 * 60 * 1000); + return calendar; } diff --git a/src/wall-display.ts b/src/wall-display.ts index 2aea3fc..c8dd9dc 100644 --- a/src/wall-display.ts +++ b/src/wall-display.ts @@ -31,4 +31,12 @@ const calendarOptions: CalendarOptions = { : [], }; -main(calendarOptions, !toolFilter); +const calendar = main(calendarOptions, !toolFilter); + +function refresh() { + calendar.refetchEvents(); + calendar.today(); +} + +// refresh data every five minutes +window.setInterval(refresh, 5 * 60 * 1000);