mirror of
https://github.com/go-gitea/gitea
synced 2024-10-19 20:10:10 +02:00
adjsut
This commit is contained in:
parent
a2e1c1475d
commit
85cf27e9cf
6
package-lock.json
generated
6
package-lock.json
generated
@ -29,6 +29,7 @@
|
||||
"esbuild-loader": "4.2.2",
|
||||
"escape-goat": "4.0.0",
|
||||
"fast-glob": "3.3.2",
|
||||
"htmx-ext-ws": "2.0.1",
|
||||
"htmx.org": "2.0.2",
|
||||
"idiomorph": "0.3.0",
|
||||
"jquery": "3.7.1",
|
||||
@ -10547,6 +10548,11 @@
|
||||
"entities": "^4.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/htmx-ext-ws": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/htmx-ext-ws/-/htmx-ext-ws-2.0.1.tgz",
|
||||
"integrity": "sha512-gddFXSzzHH9I7RWm93pGfGIKGPUo2lDtLiK8uoPn8mp/ivC0KQx4LAuQdXdg13S78lBD40Fs/mLEM/xoJCeJxQ=="
|
||||
},
|
||||
"node_modules/htmx.org": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/htmx.org/-/htmx.org-2.0.2.tgz",
|
||||
|
@ -28,6 +28,7 @@
|
||||
"esbuild-loader": "4.2.2",
|
||||
"escape-goat": "4.0.0",
|
||||
"fast-glob": "3.3.2",
|
||||
"htmx-ext-ws": "2.0.1",
|
||||
"htmx.org": "2.0.2",
|
||||
"idiomorph": "0.3.0",
|
||||
"jquery": "3.7.1",
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {showErrorToast} from './modules/toast.ts';
|
||||
import 'idiomorph/dist/idiomorph-ext.js'; // https://github.com/bigskysoftware/idiomorph#htmx
|
||||
import 'htmx.org/dist/ext/ws.js';
|
||||
import 'htmx-ext-ws';
|
||||
import type {HtmxResponseInfo} from 'htmx.org';
|
||||
|
||||
type HtmxEvent = Event & {detail: HtmxResponseInfo};
|
||||
@ -12,19 +12,19 @@ window.htmx.config.scrollIntoViewOnBoost = false;
|
||||
// https://htmx.org/events/#htmx:sendError
|
||||
document.body.addEventListener('htmx:sendError', (event: HtmxEvent) => {
|
||||
// TODO: add translations
|
||||
showErrorToast(`Network error when calling ${e.detail.requestConfig.path}`);
|
||||
showErrorToast(`Network error when calling ${event.detail.requestConfig.path}`);
|
||||
});
|
||||
|
||||
// https://htmx.org/events/#htmx:responseError
|
||||
document.body.addEventListener('htmx:responseError', (event: HtmxEvent) => {
|
||||
// TODO: add translations
|
||||
showErrorToast(`Error ${e.detail.xhr.status} when calling ${e.detail.requestConfig.path}`);
|
||||
showErrorToast(`Error ${event.detail.xhr.status} when calling ${event.detail.requestConfig.path}`);
|
||||
});
|
||||
|
||||
// TODO: move websocket creation to SharedWorker by overriding htmx.createWebSocket
|
||||
|
||||
document.body.addEventListener('htmx:wsOpen', (e) => {
|
||||
const socket = e.detail.socketWrapper;
|
||||
document.body.addEventListener('htmx:wsOpen', (event: HtmxEvent) => {
|
||||
const socket = event.detail.socketWrapper;
|
||||
socket.send(
|
||||
JSON.stringify({action: 'subscribe', data: {url: window.location.href}})
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user