Skip to content

Commit c1512d3

Browse files
committed
rename event to e
1 parent 72bb32f commit c1512d3

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

web_src/js/htmx.js

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,41 @@
1-
import * as htmx from 'htmx.org';
2-
import {showErrorToast} from './modules/toast.js';
3-
import 'htmx.org/dist/ext/ws.js';
1+
import * as htmx from "htmx.org";
2+
import { showErrorToast } from "./modules/toast.js";
3+
import "htmx.org/dist/ext/ws.js";
44

55
// https://github.com/bigskysoftware/idiomorph#htmx
6-
import 'idiomorph/dist/idiomorph-ext.js';
6+
import "idiomorph/dist/idiomorph-ext.js";
77

88
// https://htmx.org/reference/#config
9-
htmx.config.requestClass = 'is-loading';
9+
htmx.config.requestClass = "is-loading";
1010
htmx.config.scrollIntoViewOnBoost = false;
1111

1212
// https://htmx.org/events/#htmx:sendError
13-
document.body.addEventListener('htmx:sendError', (event) => {
13+
document.body.addEventListener("htmx:sendError", (event) => {
1414
// TODO: add translations
15-
showErrorToast(`Network error when calling ${event.detail.requestConfig.path}`);
15+
showErrorToast(
16+
`Network error when calling ${event.detail.requestConfig.path}`
17+
);
1618
});
1719

1820
// https://htmx.org/events/#htmx:responseError
19-
document.body.addEventListener('htmx:responseError', (event) => {
21+
document.body.addEventListener("htmx:responseError", (event) => {
2022
// TODO: add translations
21-
showErrorToast(`Error ${event.detail.xhr.status} when calling ${event.detail.requestConfig.path}`);
23+
showErrorToast(
24+
`Error ${event.detail.xhr.status} when calling ${event.detail.requestConfig.path}`
25+
);
2226
});
2327

2428
// eslint-disable-next-line no-import-assign
2529
htmx.createWebSocket = (url) => {
2630
// TODO: reuse websocket from shared webworker
2731
const sock = new WebSocket(url, []);
2832
sock.binaryType = htmx.config.wsBinaryType;
33+
g;
2934
return sock;
3035
};
31-
document.body.addEventListener('htmx:wsOpen', (evt) => {
32-
const socket = evt.detail.socketWrapper;
33-
socket.send(JSON.stringify({action: 'subscribe', data: {url: window.location.href}}));
36+
document.body.addEventListener("htmx:wsOpen", (e) => {
37+
const socket = e.detail.socketWrapper;
38+
socket.send(
39+
JSON.stringify({ action: "subscribe", data: { url: window.location.href } })
40+
);
3441
});

0 commit comments

Comments
 (0)