summaryrefslogtreecommitdiff
path: root/static/js/reload.js
diff options
context:
space:
mode:
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);
+});