26 lines
784 B
HTML
26 lines
784 B
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
|
<title>Wabi Spectrum</title>
|
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
|
</head>
|
|
<body>
|
|
<section id="log">
|
|
<h1>Incoming Events</h1>
|
|
</section>
|
|
<template id="logline">
|
|
<p>Count updated: <span></span>
|
|
</template>
|
|
<script>
|
|
"use strict";
|
|
let sse = new EventSource('events');
|
|
sse.addEventListener('count', msg => {
|
|
const template = document.querySelector('#logline').content.cloneNode(true);
|
|
template.querySelector('span').textContent = msg.data;
|
|
document.querySelector('#log').appendChild(template);
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|