1
1
Fork 1
mirror of https://github.com/go-gitea/gitea.git synced 2024-05-19 20:46:11 +02:00

remove websocket init for now, fix lint

This commit is contained in:
silverwind 2024-03-04 22:22:07 +01:00
parent 77f89b7314
commit 1602afdd3e
No known key found for this signature in database
GPG Key ID: 2E62B41C93869443

View File

@ -21,20 +21,11 @@ document.body.addEventListener('htmx:responseError', (e) => {
showErrorToast(`Error ${e.detail.xhr.status} when calling ${e.detail.requestConfig.path}`);
});
let webSocket;
// TODO: move websocket creation to shared webworker
htmx.createWebSocket = (url) => {
if (![0, 1].includes(webSocket?.readyState)) return webSocket;
const ws = new WebSocket(url, []);
ws.binaryType = htmx.config.wsBinaryType;
webSocket = ws;
return ws;
};
// TODO: move websocket creation to shared webworker by overriding htmx.createWebSocket
document.body.addEventListener('htmx:wsOpen', (e) => {
const socket = e.detail.socketWrapper;
socket.send(
JSON.stringify({ action: 'subscribe', data: { url: window.location.href } })
JSON.stringify({action: 'subscribe', data: {url: window.location.href}})
);
});