refactor: remove unused unsubscribe function from journalStream
This commit is contained in:
parent
960e310208
commit
c9c977bee1
|
|
@ -60,7 +60,7 @@ export type { SessionManifest } from "../../workers/journal.worker";
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
let _workerAPI: Comlink.Remote<JournalWorkerAPI> | null = null;
|
let _workerAPI: Comlink.Remote<JournalWorkerAPI> | null = null;
|
||||||
let _unsubscribe: (() => void) | null = null;
|
|
||||||
|
|
||||||
function getWorkerAPI(): Comlink.Remote<JournalWorkerAPI> {
|
function getWorkerAPI(): Comlink.Remote<JournalWorkerAPI> {
|
||||||
if (!_workerAPI) {
|
if (!_workerAPI) {
|
||||||
|
|
@ -226,7 +226,7 @@ async function ensureSubscribed(): Promise<void> {
|
||||||
_subscribed = true;
|
_subscribed = true;
|
||||||
|
|
||||||
const api = getWorkerAPI();
|
const api = getWorkerAPI();
|
||||||
_unsubscribe = await api.subscribe(
|
await api.subscribe(
|
||||||
Comlink.proxy((patch: WorkerPatch) => {
|
Comlink.proxy((patch: WorkerPatch) => {
|
||||||
handlePatch(patch);
|
handlePatch(patch);
|
||||||
}),
|
}),
|
||||||
|
|
|
||||||
|
|
@ -496,7 +496,7 @@ const api = {
|
||||||
},
|
},
|
||||||
|
|
||||||
/** Register a callback for state patches. Sends full state immediately. */
|
/** 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;
|
const cb = callback as PatchCallback;
|
||||||
subscribers.add(cb);
|
subscribers.add(cb);
|
||||||
// Send initial full state
|
// Send initial full state
|
||||||
|
|
@ -513,9 +513,6 @@ const api = {
|
||||||
} catch {
|
} catch {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
return () => {
|
|
||||||
subscribers.delete(cb);
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue