fix types

This commit is contained in:
undefined committed 2024-01-06 13:39:27 +08:00
1 parent 91179ebe66
commit 98c917ed4a
7 files changed
+11 -18

No files matched your search

-1
View File
@@ -243,7 +243,6 @@ async function handle(ctx: KoaContext, HandlerClass, checker) {
args, request, response, user, domain, UiContext,
} = ctx.HydroContext;
Object.assign(args, ctx.params);
console.log(ctx.HydroContext);
const h = new HandlerClass(ctx, args, request, response, user, domain, UiContext);
ctx.handler = h;
try {
@@ -1,9 +1,9 @@
/* eslint-disable no-restricted-globals */
/// <reference no-default-lib="true" />
/// <reference lib="ES2015" />
/// <reference types="@types/sharedworker" />
/// <reference lib="webworker" />
import ReconnectingWebsocket from 'reconnecting-websocket';
import { FLAG_INFO } from 'vj/constant/message';
declare const self: SharedWorkerGlobalScope;
console.log('SharedWorker init');
@@ -75,7 +75,7 @@ function initConn(path: string, port: MessagePort, cookie: any) {
};
}
onconnect = function (e) { // eslint-disable-line no-undef
self.onconnect = function (e) { // eslint-disable-line no-undef
const port = e.ports[0];
port.addEventListener('message', (msg: { data: RequestPayload }) => {
-2
View File
@@ -37,8 +37,6 @@
"@types/react": "^18.2.46",
"@types/react-dom": "^18.2.18",
"@types/redux-logger": "^3.0.12",
"@types/serviceworker": "^0.0.82",
"@types/sharedworker": "^0.0.111",
"@types/webpack-env": "^1.18.4",
"@vscode/codicons": "^0.0.35",
"ajv": "^8.12.0",
+7 -6
View File
@@ -1,8 +1,9 @@
/// <reference no-default-lib="true"/>
/// <reference lib="ES2015" />
/// <reference types="@types/serviceworker" />
/* global clients */
/* eslint-disable no-restricted-globals */
/// <reference no-default-lib="true" />
/// <reference lib="webworker" />
export { }; // make it a module so that declare self works
declare const self: ServiceWorkerGlobalScope;
const map = new Map();
function createStream(port) {
@@ -78,11 +79,11 @@ self.addEventListener('notificationclick', (event) => {
console.log('On notification click: ', event.notification.tag);
event.notification.close();
if (!event.notification.tag.startsWith('message-')) return;
event.waitUntil(clients.matchAll({ type: 'window' }).then((clientList) => {
event.waitUntil(self.clients.matchAll({ type: 'window' }).then((clientList) => {
for (const client of clientList) {
if (client.url === '/home/messages' && 'focus' in client) return client.focus();
}
if (clients.openWindow) clients.openWindow('/home/messages');
if (self.clients.openWindow) self.clients.openWindow('/home/messages');
return null;
}));
});