summaryrefslogtreecommitdiff
path: root/static/js/reload.js
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-08-21 12:11:35 +0200
committerDaniel Friesel <derf@finalrewind.org>2021-08-21 12:11:35 +0200
commitf5a6a5927bfcc4a2b82c34db5041bfe3a49b95e6 (patch)
treed9508512ae32be6ecc865607539c16566db2756e /static/js/reload.js
parent8a04cf20c5d6dc577a7de7745cbeb292bf78529d (diff)
refresh departure list every minute0.2.0
Diffstat (limited to 'static/js/reload.js')
-rw-r--r--static/js/reload.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/static/js/reload.js b/static/js/reload.js
new file mode 100644
index 0000000..9bdc7c0
--- /dev/null
+++ b/static/js/reload.js
@@ -0,0 +1,13 @@
+document.addEventListener("DOMContentLoaded", function() {
+ const departureList = document.getElementById('departurelist');
+
+ const showDepartures = (departureText) => {
+ departureList.innerHTML = departureText;
+ };
+
+ const fetchDepartures = () => {
+ fetch(window.location.href + '?ajax=1').then(response => response.text()).then(showDepartures);
+ };
+
+ setInterval(fetchDepartures, 60000);
+});