Skip to content

Commit b0c1110

Browse files
committed
use ts strict type
1 parent 11443d8 commit b0c1110

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

web_src/js/features/notification.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import {logoutFromWorker} from '../modules/worker.ts';
55
const {appSubUrl, notificationSettings, assetVersionEncoded} = window.config;
66
let notificationSequenceNumber = 0;
77

8-
async function receiveUpdateCount(event: MessageEvent) {
8+
async function receiveUpdateCount(event: MessageEvent<{type: string, data: string}>) {
99
try {
10-
const data = event.data;
10+
const data = JSON.parse(event.data.data);
1111
for (const count of document.querySelectorAll('.notification_count')) {
1212
count.classList.toggle('tw-hidden', data.Count === 0);
1313
count.textContent = `${data.Count}`;
@@ -44,7 +44,7 @@ export function initNotificationCount() {
4444
type: 'start',
4545
url: `${window.location.origin}${appSubUrl}/user/events`,
4646
});
47-
worker.port.addEventListener('message', (event: MessageEvent) => {
47+
worker.port.addEventListener('message', (event: MessageEvent<{type: string, data: string}>) => {
4848
if (!event.data || !event.data.type) {
4949
console.error('unknown worker message event', event);
5050
return;

0 commit comments

Comments
 (0)