11import { showErrorToast } from './modules/toast.ts' ;
22import 'idiomorph/dist/idiomorph-ext.js' ; // https://github.com/bigskysoftware/idiomorph#htmx
3- import 'htmx.org/dist/ ext/ws.js ' ;
3+ import 'htmx- ext-ws ' ;
44import type { HtmxResponseInfo } from 'htmx.org' ;
55
66type HtmxEvent = Event & { detail : HtmxResponseInfo } ;
@@ -12,19 +12,19 @@ window.htmx.config.scrollIntoViewOnBoost = false;
1212// https://htmx.org/events/#htmx:sendError
1313document . 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
1919document . 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