refactor: proper websocket message types

This commit is contained in:
Elian Doran
2025-09-13 12:54:53 +03:00
parent 998688573d
commit 4cd0702cbb
19 changed files with 164 additions and 170 deletions

View File

@@ -5,6 +5,7 @@ import options from "../services/options.js";
import syncService from "../services/sync.js";
import { escapeQuotes } from "../services/utils.js";
import { Tooltip } from "bootstrap";
import { WebSocketMessage } from "@triliumnext/commons";
const TPL = /*html*/`
<div class="sync-status-widget launcher-button">
@@ -117,8 +118,7 @@ export default class SyncStatusWidget extends BasicWidget {
this.$widget.find(`.sync-status-${className}`).show();
}
// TriliumNextTODO: Use Type Message from "services/ws.ts"
processMessage(message: { type: string; lastSyncedPush: number; data: { lastSyncedPush: number } }) {
processMessage(message: WebSocketMessage) {
if (message.type === "sync-pull-in-progress") {
this.syncState = "in-progress";
this.lastSyncedPush = message.lastSyncedPush;