summaryrefslogtreecommitdiff
path: root/static/js/reload.js
blob: 9bdc7c0ddd495f22841173a333a475a5ee8a50bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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);
});