mirror of
https://github.com/Michatec/MiniFaceBook.git
synced 2026-04-01 16:06:28 +02:00
19 lines
479 B
JavaScript
19 lines
479 B
JavaScript
function reloadEvents() {
|
|
fetch(apiEventsUrl)
|
|
.then(r => r.json())
|
|
.then(events => {
|
|
let tbody = document.getElementById('events-tbody');
|
|
tbody.innerHTML = "";
|
|
for (let e of events) {
|
|
let tr = document.createElement('tr');
|
|
tr.innerHTML = `<td>${e.timestamp}</td><td>${e.message}</td>`;
|
|
tbody.appendChild(tr);
|
|
}
|
|
});
|
|
}
|
|
|
|
$(function() {
|
|
setInterval(function() {
|
|
reloadEvents();
|
|
}, 1000);
|
|
}); |