refactor: remove unused unsubscribe function from journalStream

This commit is contained in:
hypercross 2026-07-13 00:54:20 +08:00
parent 960e310208
commit c9c977bee1
2 changed files with 3 additions and 6 deletions

View File

@ -60,7 +60,7 @@ export type { SessionManifest } from "../../workers/journal.worker";
// ---------------------------------------------------------------------------
let _workerAPI: Comlink.Remote<JournalWorkerAPI> | null = null;
let _unsubscribe: (() => void) | null = null;
function getWorkerAPI(): Comlink.Remote<JournalWorkerAPI> {
if (!_workerAPI) {
@ -226,7 +226,7 @@ async function ensureSubscribed(): Promise<void> {
_subscribed = true;
const api = getWorkerAPI();
_unsubscribe = await api.subscribe(
await api.subscribe(
Comlink.proxy((patch: WorkerPatch) => {
handlePatch(patch);
}),

View File

@ -496,7 +496,7 @@ const api = {
},
/** Register a callback for state patches. Sends full state immediately. */
subscribe(callback: Comlink.ProxyOrClone<PatchCallback>): () => void {
subscribe(callback: Comlink.ProxyOrClone<PatchCallback>): void {
const cb = callback as PatchCallback;
subscribers.add(cb);
// Send initial full state
@ -513,9 +513,6 @@ const api = {
} catch {
// ignore
}
return () => {
subscribers.delete(cb);
};
},
};