-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.html
More file actions
26 lines (24 loc) · 842 Bytes
/
index.html
File metadata and controls
26 lines (24 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="icon" type="image/x-icon" href="favicon.ico">
<title> MicroPython HTTPserver </title>
</head>
<body>
<h1> Ahllo </h1>
<p id="time"> hh:mm:ss </p>
<script>
window.onload = function() {
// Setup time event listener
const timeEventSource = new EventSource("/api/time");
timeEventSource.addEventListener("time", (event) => {
document.getElementById("time").innerHTML = event.data;
});
timeEventSource.onerror = (event) => {
console.log(timeEventSource.url, "error");
timeEventSource.close();
};
}
</script>
</body>
</html>