Skip to content

Commit 85cf27e

Browse files
committed
adjsut
1 parent a2e1c14 commit 85cf27e

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"esbuild-loader": "4.2.2",
2929
"escape-goat": "4.0.0",
3030
"fast-glob": "3.3.2",
31+
"htmx-ext-ws": "2.0.1",
3132
"htmx.org": "2.0.2",
3233
"idiomorph": "0.3.0",
3334
"jquery": "3.7.1",

web_src/js/htmx.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {showErrorToast} from './modules/toast.ts';
22
import 'idiomorph/dist/idiomorph-ext.js'; // https://github.com/bigskysoftware/idiomorph#htmx
3-
import 'htmx.org/dist/ext/ws.js';
3+
import 'htmx-ext-ws';
44
import type {HtmxResponseInfo} from 'htmx.org';
55

66
type HtmxEvent = Event & {detail: HtmxResponseInfo};
@@ -12,19 +12,19 @@ window.htmx.config.scrollIntoViewOnBoost = false;
1212
// https://htmx.org/events/#htmx:sendError
1313
document.body.addEventListener('htmx:sendError', (event: HtmxEvent) => {
1414
// TODO: add translations
15-
showErrorToast(`Network error when calling ${e.detail.requestConfig.path}`);
15+
showErrorToast(`Network error when calling ${event.detail.requestConfig.path}`);
1616
});
1717

1818
// https://htmx.org/events/#htmx:responseError
1919
document.body.addEventListener('htmx:responseError', (event: HtmxEvent) => {
2020
// TODO: add translations
21-
showErrorToast(`Error ${e.detail.xhr.status} when calling ${e.detail.requestConfig.path}`);
21+
showErrorToast(`Error ${event.detail.xhr.status} when calling ${event.detail.requestConfig.path}`);
2222
});
2323

2424
// TODO: move websocket creation to SharedWorker by overriding htmx.createWebSocket
2525

26-
document.body.addEventListener('htmx:wsOpen', (e) => {
27-
const socket = e.detail.socketWrapper;
26+
document.body.addEventListener('htmx:wsOpen', (event: HtmxEvent) => {
27+
const socket = event.detail.socketWrapper;
2828
socket.send(
2929
JSON.stringify({action: 'subscribe', data: {url: window.location.href}})
3030
);

0 commit comments

Comments
 (0)