CommentStore
Defined in: comments/store.ts:61
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new CommentStore(options?): CommentStore;Defined in: comments/store.ts:73
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options | CommentStoreOptions |
Returns
Section titled “Returns”CommentStore
Properties
Section titled “Properties”| Property | Modifier | Type | Defined in |
|---|---|---|---|
actor | readonly | string | comments/store.ts:62 |
Methods
Section titled “Methods”addComment()
Section titled “addComment()”addComment(threadId, input): string;Defined in: comments/store.ts:115
Append a reply to an existing thread. Returns the new comment id.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
threadId | string |
input | AddCommentInput |
Returns
Section titled “Returns”string
createThread()
Section titled “createThread()”createThread(input): { commentId: string; threadId: string;};Defined in: comments/store.ts:98
Open a new thread with its first comment. Returns the ids so the caller
can stamp the matching commentMark onto the document range.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
input | CreateThreadInput |
Returns
Section titled “Returns”{ commentId: string; threadId: string;}commentId
Section titled “commentId”commentId: string;threadId
Section titled “threadId”threadId: string;deleteComment()
Section titled “deleteComment()”deleteComment(commentId): void;Defined in: comments/store.ts:133
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
commentId | string |
Returns
Section titled “Returns”void
deleteThread()
Section titled “deleteThread()”deleteThread(threadId): void;Defined in: comments/store.ts:145
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
threadId | string |
Returns
Section titled “Returns”void
editComment()
Section titled “editComment()”editComment(commentId, body): void;Defined in: comments/store.ts:129
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
commentId | string |
body | string |
Returns
Section titled “Returns”void
getThread()
Section titled “getThread()”getThread(threadId): | CommentThread | undefined;Defined in: comments/store.ts:85
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
threadId | string |
Returns
Section titled “Returns”| CommentThread
| undefined
ingest()
Section titled “ingest()”ingest(events): void;Defined in: comments/store.ts:159
Merge remote events. Idempotent (dedupes by event id) and echo-free
(does NOT notify onLocalEvents). Notifies UI subscribers if anything
actually changed.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
events | readonly CommentEvent[] |
Returns
Section titled “Returns”void
onLocalEvents()
Section titled “onLocalEvents()”onLocalEvents(listener): Unsubscribe;Defined in: comments/store.ts:179
Subscribe to locally authored events only (for fan-out by CommentSync).
Remote events ingested via ingest do NOT fire this — prevents echo loops.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
listener | (events) => void |
Returns
Section titled “Returns”Unsubscribe
openThreadIds()
Section titled “openThreadIds()”openThreadIds(): Set<string>;Defined in: comments/store.ts:90
Thread ids that currently have at least one visible (non-deleted) comment.
Returns
Section titled “Returns”Set<string>
reopenThread()
Section titled “reopenThread()”reopenThread(threadId, by?): void;Defined in: comments/store.ts:141
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
threadId | string |
by? | CommentAuthor |
Returns
Section titled “Returns”void
resolveThread()
Section titled “resolveThread()”resolveThread(threadId, by?): void;Defined in: comments/store.ts:137
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
threadId | string |
by? | CommentAuthor |
Returns
Section titled “Returns”void
snapshot()
Section titled “snapshot()”snapshot(): CommentEvent[];Defined in: comments/store.ts:152
The full event log — send to a freshly-joined peer.
Returns
Section titled “Returns”subscribe()
Section titled “subscribe()”subscribe(listener): Unsubscribe;Defined in: comments/store.ts:172
Subscribe to materialized-state changes (for UI re-render).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
listener | () => void |
Returns
Section titled “Returns”Unsubscribe
threads()
Section titled “threads()”threads(): CommentThread[];Defined in: comments/store.ts:80
All non-deleted threads, newest first.