prev chunk
Browse files- display/index.html +7 -1
display/index.html
CHANGED
|
@@ -5,13 +5,19 @@
|
|
| 5 |
</head>
|
| 6 |
<body>
|
| 7 |
<h1>
|
| 8 |
-
|
|
|
|
| 9 |
</h1>
|
| 10 |
|
| 11 |
<script>
|
| 12 |
window.onload = () => {
|
| 13 |
const eventSource = new EventSource('http://localhost:8343/test');
|
|
|
|
|
|
|
| 14 |
evtSource.onmessage = (e) => {
|
|
|
|
|
|
|
|
|
|
| 15 |
console.log(e.data);
|
| 16 |
};
|
| 17 |
}
|
|
|
|
| 5 |
</head>
|
| 6 |
<body>
|
| 7 |
<h1>
|
| 8 |
+
<div class="text"></div>
|
| 9 |
+
<div class="next-text"></div>
|
| 10 |
</h1>
|
| 11 |
|
| 12 |
<script>
|
| 13 |
window.onload = () => {
|
| 14 |
const eventSource = new EventSource('http://localhost:8343/test');
|
| 15 |
+
const allText = document.querySelector('.text');
|
| 16 |
+
const nextText = document.querySelector('.next-text');
|
| 17 |
evtSource.onmessage = (e) => {
|
| 18 |
+
const message = e.data;
|
| 19 |
+
nextText.innerHTML = message;
|
| 20 |
+
|
| 21 |
console.log(e.data);
|
| 22 |
};
|
| 23 |
}
|