Skip to content

Interface: CommentsEngine

@roomful/core


@roomful/core / CommentsEngine

Defined in: packages/core/src/types.ts:2120

Exposes collaborative comment threads for a room. Threads are synced collaborative state, shared across peers over the room’s existing CRDT channel.

add(input): Promise<CommentThread>

Defined in: packages/core/src/types.ts:2128

Opens a new thread authored by the local peer at anchor. The thread id and createdAt are generated.

The thread anchor and root comment body.

CommentAnchor

string

Promise<CommentThread>

A promise resolving to the created thread.


getAll(): CommentThread[]

Defined in: packages/core/src/types.ts:2145

Returns every thread, oldest first.

CommentThread[]

The current threads.


getByElement(elementId): CommentThread[]

Defined in: packages/core/src/types.ts:2154

Returns the threads anchored to elementId (element or text-range anchors).

string

The element id to filter by.

CommentThread[]

The matching threads.


getOpen(): CommentThread[]

Defined in: packages/core/src/types.ts:2161

Returns the unresolved threads.

CommentThread[]

The open threads.


subscribe(callback): Unsubscribe

Defined in: packages/core/src/types.ts:2170

Subscribes to thread changes. Fires immediately with the current threads, then on every local or remote mutation.

(threads) => void

The callback invoked with the latest threads.

Unsubscribe

A function that removes the listener.


thread(id): CommentThreadHandle

Defined in: packages/core/src/types.ts:2138

Resolves a handle for operating on the thread with id. The handle methods no-op against an unknown id until it surfaces, then resolve to the latest thread.

string

The thread id.

CommentThreadHandle

A handle exposing reply, resolve, and reopen.