
ืฉืคื ๐ฎ๐ฑ ืขืืจืืช
ืชืืขืื
ืืชืืื
ืฉืืืืฉ
ืชืฆืืจื
Add Comments to Your SolidJS App
ืืืื ืืกืคืจืืื ืืจืฉืืืช ืฉื FastComments ืโSolidJS.
ืืืืข ืืืืื'ืืื ืฉื ืชืืืืืช ืืืื ืืืช, ืฆ'ืื ืืืืงืืจืืช ืืืคืืืงืฆืืืช SolidJS ืฉืื.
ืืืืจ
ืืืืื ืืื 
ื ืกื ืื ืืืืื'ื ืืฉืืืืจ ืื ื https://fastcomments.com/commenting-system-for-solidjs.
ืฉืืืืฉ 
import { FastCommentsCommentWidget } from 'fastcomments-solidjs';
export default function App() {
return <FastCommentsCommentWidget tenantId="demo" urlId="some-page-id" />;
}
ืชืืืื ืืฉืื ืืืื ืืชืฆืืจื (ืืืคืื ืืืืคืจืืืื) 
Solid ืื ืขืืงืืช ืืืืคื ืืืืืืื ืืืจื ืฉืื ืืืื ืขืืืงืื ืขื ืืืืืืงืืื ืืงืจืืืื, ืื
ืฉืฉืื ืืืื ืืงืื ืคืืืืจืฆืื ืืืืจ ื-render ืืจืืฉืื ืืืืืื ืืืืืช ืืืขืืจืื ืืืคืืจืฉ. ืื ืืืืื'ื
ืืงืื apiRef ืฉืืืืืจ handle; ืงืจืื ื-handle.update(partial) ืืชืื
createEffect ืืื ืืื ืืข ืจืืืงืืืืืืช:
import { createEffect, createSignal } from 'solid-js';
import { FastCommentsCommentWidget, type FastCommentsCommentWidgetHandle } from 'fastcomments-solidjs';
export default function Paginated() {
const [page, setPage] = createSignal(0);
let handle: FastCommentsCommentWidgetHandle | undefined;
createEffect(() => handle?.update({ urlId: `product-${page()}` }));
return (
<>
<button onClick={() => setPage(page() + 1)}>next</button>
<FastCommentsCommentWidget
apiRef={(h) => (handle = h)}
tenantId="demo"
urlId={`product-${page()}`}
/>
</>
);
}
update() ืืืื ืืงืจืืื ืืื ืขืช:
- Before the script has loaded: the partial is stashed and applied at init.
- During an async init (reviews-summary, user-activity-feed): the partial is queued and applied when the callback resolves.
- After init: it forwards straight to the live widget's
.update()method.
API ืืืืคืจืืืื ืฉื ื-handle
interface WidgetHandle<Config> {
getInstance: () => WidgetInstance | null; // ืืืืคืข ืืื ืืืืจืื (ืื null ืืคื ื ืืืจืืื)
onInstance: (cb: (instance: WidgetInstance) => void) => void; // ื ืงืจื ืคืขื ืืืช ืืฉืืืืคืข ืืืื
update: (partial: Partial<Config>) => void; // ืืืืื ืืืืืคืช ืืงืื ืคืืืืจืฆืื
}
Use getInstance() for imperative actions that aren't covered by .update(), e.g. openProfile:
const openProfile = () =>
(handle?.getInstance() as { openProfile?: (o: { userId: string }) => void } | null)
?.openProfile?.({ userId: 'demo' });
ืจืืืืื 
ืื ืืืืื'ื ืึพfastcomments-react ืืืื ืชืืช ืืฉืืืช ืืืืื:
| Component | Handle type | Embed loaded |
|---|---|---|
FastCommentsCommentWidget |
FastCommentsCommentWidgetHandle |
ืืืื'ื ืชืืืืืช ืืืืช ืจืืฉื |
FastCommentsCommentCountWidget |
FastCommentsCommentCountWidgetHandle |
ืชื ืกืคืืจืช ืชืืืืืช ืคื ืืื |
FastCommentsLiveChatWidget |
FastCommentsLiveChatWidgetHandle |
ืืืื'ื ืฆ'ืื ืื ืืืจื |
FastCommentsCollabChatWidget |
FastCommentsCollabChatWidgetHandle |
ืฆ'ืื ืฉืืชืืคื ืืขืืื ืืืงืกื |
FastCommentsImageChatWidget |
FastCommentsImageChatWidgetHandle |
ืชืืืืืช ืชืืื ื ืืืืกืกืืช ืืืืจืื |
FastCommentsRecentCommentsWidget |
FastCommentsRecentCommentsWidgetHandle |
ืคืื ืชืืืืืช ืืืจืื ืืช |
FastCommentsRecentDiscussionsWidget |
FastCommentsRecentDiscussionsWidgetHandle |
ืคืื ืืืื ืื ืืืจืื ืื |
FastCommentsReviewsSummaryWidget |
FastCommentsReviewsSummaryWidgetHandle |
ืกืืืื ืืืจืื ืืืืืืื |
FastCommentsTopPagesWidget |
FastCommentsTopPagesWidgetHandle |
ืืืืช ืืืืืืื ืฉื ืืคืื ืขื ืืื ืืจืื ืชืืืืืช |
FastCommentsUserActivityFeedWidget |
FastCommentsUserActivityFeedWidgetHandle |
ืฆืืจ ืืื ืคืขืืืืช ืืื ืืฉืชืืฉ |
ืืืืื'ืืื ืฉืืชืืืจืื ืืืืื ื ืงืืื
FastCommentsCollabChatWidget ืึพFastCommentsImageChatWidget ืืืฆืืืื ืื ืืืื ื ืฉืืกืืคืง ืขื ืืื ืืงืืจื. ืืขืืจ ืคืื ืงืฆืืืช ืืืฉื (targetRef) ืฉืืืืืจื ืืช ืืืืื ื ืืืืจ ืฉืืื ืืืชืงื:
import { FastCommentsImageChatWidget } from 'fastcomments-solidjs';
export default function ImageChat() {
let img: HTMLImageElement | undefined;
return (
<>
<img ref={img} src="/screenshot.png" alt="" />
<FastCommentsImageChatWidget
tenantId="demo"
urlId="my-image"
targetRef={() => img}
/>
</>
);
}
ืืืืจืื
ืืขืืจ region="eu" ืืื ืื ืชื ืืช ืืชื ืืขื ืฉื ืืืืืื'ื ืืจื ืืฉืืื ืโEU.
ืืฆืื 
ืืคืืืงืฆืืืช ืชืฆืืื ืืืื ื ืืฆืืช ืexamples/example-showcase/. ืืื ืืฉืงืคืช ืืช ืชืฆืืืช React ืืืืกื ืืช ืื
ืืืืืื'ืืื ืืื ืืจืืืืช ื ืคืืฆืืช (ืืฆื ืืื, ืขืืืื, SSO, ืงืจืืืืช ืืืจื).
cd examples/example-showcase
npm install
npm run dev
ืืงืืงืื ืืขืืจื?
ืื ืืชื ื ืชืงืืื ืืืขืืืช ืื ืืฉ ืืื ืฉืืืืช ืืืื ืกืคืจืืืช SolidJS, ืื ื:
ืืฉืชืชืคืืช
ืชืจืืืืช ืืชืงืืืืช ืืืจืื! ืื ื ืืงืจื ื-ืืืืจ ื-GitHub ืืื ืืืืช ืืชืจืืื.