Skip to content

Commit abcc609

Browse files
committed
fix
1 parent 85cf27e commit abcc609

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

web_src/js/htmx.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ import 'idiomorph/dist/idiomorph-ext.js'; // https://github.com/bigskysoftware/i
33
import 'htmx-ext-ws';
44
import type {HtmxResponseInfo} from 'htmx.org';
55

6-
type HtmxEvent = Event & {detail: HtmxResponseInfo};
6+
type SocketWrapper = {
7+
send: (msg: string) => void;
8+
};
9+
type HtmxEvent = Event & {detail: HtmxResponseInfo & {socketWrapper: SocketWrapper}};
710

811
// https://htmx.org/reference/#config
912
window.htmx.config.requestClass = 'is-loading';
@@ -26,6 +29,6 @@ document.body.addEventListener('htmx:responseError', (event: HtmxEvent) => {
2629
document.body.addEventListener('htmx:wsOpen', (event: HtmxEvent) => {
2730
const socket = event.detail.socketWrapper;
2831
socket.send(
29-
JSON.stringify({action: 'subscribe', data: {url: window.location.href}})
32+
JSON.stringify({action: 'subscribe', data: {url: window.location.href}}),
3033
);
3134
});

0 commit comments

Comments
 (0)