button presses -> sse -> web display
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user