Interface: UseCommentsResult
@roomful/react / UseCommentsResult
Interface: UseCommentsResult
Section titled “Interface: UseCommentsResult”Defined in: react/src/index.ts:312
Describes the return value of useComments.
Properties
Section titled “Properties”add: (
input) =>Promise<CommentThread>
Defined in: react/src/index.ts:322
Opens a new thread authored by the local peer at an anchor.
Opens a new thread authored by the local peer at anchor. The thread id
and createdAt are generated.
Parameters
Section titled “Parameters”The thread anchor and root comment body.
anchor
Section titled “anchor”CommentAnchor
string
Returns
Section titled “Returns”Promise<CommentThread>
A promise resolving to the created thread.
getByElement()
Section titled “getByElement()”getByElement: (
elementId) =>CommentThread[]
Defined in: react/src/index.ts:352
Returns the threads anchored to an element.
Returns the threads anchored to elementId (element or text-range
anchors).
Parameters
Section titled “Parameters”elementId
Section titled “elementId”string
The element id to filter by.
Returns
Section titled “Returns”CommentThread[]
The matching threads.
getOpen()
Section titled “getOpen()”getOpen: () =>
CommentThread[]
Defined in: react/src/index.ts:357
Returns the unresolved threads.
Returns the unresolved threads.
Returns
Section titled “Returns”CommentThread[]
The open threads.
threads
Section titled “threads”threads:
CommentThread[]
Defined in: react/src/index.ts:317
Exposes the current comment threads, oldest first. Reactive: re-renders on any local or remote thread change.
Methods
Section titled “Methods”reopen()
Section titled “reopen()”reopen(
threadId):Promise<CommentThread>
Defined in: react/src/index.ts:347
Reopens a resolved thread.
Parameters
Section titled “Parameters”threadId
Section titled “threadId”string
The thread to reopen.
Returns
Section titled “Returns”Promise<CommentThread>
A promise resolving to the updated thread.
reply()
Section titled “reply()”reply(
threadId,text):Promise<CommentThread>
Defined in: react/src/index.ts:331
Appends a reply authored by the local peer to a thread.
Parameters
Section titled “Parameters”threadId
Section titled “threadId”string
The thread to reply to.
string
The reply body.
Returns
Section titled “Returns”Promise<CommentThread>
A promise resolving to the updated thread.
resolve()
Section titled “resolve()”resolve(
threadId):Promise<CommentThread>
Defined in: react/src/index.ts:339
Marks a thread resolved.
Parameters
Section titled “Parameters”threadId
Section titled “threadId”string
The thread to resolve.
Returns
Section titled “Returns”Promise<CommentThread>
A promise resolving to the updated thread.