mirror of
https://github.com/Michatec/MiniFaceBook.git
synced 2026-03-31 23:46:30 +02:00
Files
This commit is contained in:
16
static/js/events.js
Normal file
16
static/js/events.js
Normal file
@@ -0,0 +1,16 @@
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setInterval(reloadEvents, 10000);
|
||||
window.onload = reloadEvents;
|
||||
Reference in New Issue
Block a user