mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-10-02 15:25:26 +00:00
43 lines
1.4 KiB
HTML
43 lines
1.4 KiB
HTML
<html>
|
|
<head>
|
|
<script src="../../src/htmx.js"></script>
|
|
<script src="../../src/ext/sse.js"></script>
|
|
<script>
|
|
// "withCredentials:false" is necessary to circumvent CORS restrictions
|
|
htmx.createEventSource = function(url){
|
|
return new EventSource(url, {withCredentials:false})
|
|
}
|
|
</script>
|
|
<style>
|
|
*{
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
|
}
|
|
|
|
body {
|
|
background-color: #eeeeee;
|
|
}
|
|
|
|
.container {
|
|
padding: 10px;
|
|
border: solid 1px gray;
|
|
margin-bottom: 20px;
|
|
background-color:white;
|
|
}
|
|
|
|
.bold {
|
|
font-weight:bold;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<div id="page">
|
|
<h3>Multiple Listeners. message only</h3>
|
|
<div class="container" hx-ext="sse" sse-url="http://localhost/posts.html" sse-swap="message">Waiting for Posts...</div>
|
|
<div class="container" hx-ext="sse" sse-url="http://localhost/comments.html" sse-swap="message">Waiting for Comments...</div>
|
|
<div class="container" hx-ext="sse" sse-url="http://localhost/albums.html" sse-swap="message">Waiting for Albums...</div>
|
|
<div class="container" hx-ext="sse" sse-url="http://localhost/todos.html" sse-swap="message">Waiting for ToDos...</div>
|
|
<div class="container" hx-ext="sse" sse-url="http://localhost/users.html" sse-swap="message">Waiting for Users...</div>
|
|
</div>
|
|
</body>
|
|
</html> |