button presses -> sse -> web display

This commit is contained in:
2020-10-14 12:58:31 -07:00
parent 3b86c9fe21
commit 069099c7bb
3 changed files with 67 additions and 12 deletions

View File

@@ -1,9 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Fáfnir Doorbell</title>
</head>
<body>
<section id="log">
<h1>Incoming Events</h1>
</section>
<template id="ring">
<p>Ring!
</template>
<script>
"use strict";
let sse = new EventSource('events');
sse.addEventListener('ring', msg => {
const template = document.querySelector('#ring').content.cloneNode(true);
document.querySelector('#log').appendChild(template);
});
</script>
</body>
</html>