function
connectLivePreview
function connectLivePreview<Data extends object>(
{
adminOrigin, target: expectedTarget, onUpdate, window: injectedWindow,
}: {
adminOrigin: string
target: LivePreviewTarget
onUpdate: (message: RiduLivePreviewUpdateMessage<
Data
>) => void
window?: object
},
): LivePreviewConnection<Data>Connect a frontend preview window or iframe to authenticated admin updates.
Source packages/sdk/src/index.ts:4
The URL must contain __ridu_preview and run in an iframe or opener. Messages are checked against origin, source window, channel, resource, slug, and ID. Call disconnect on unmount.
Related types
LivePreviewTargetThe collection or global identity accepted by a preview route.
RiduLivePreviewUpdateMessageOne sequenced preview update accepted from the admin.
LivePreviewConnectionA disposable live-preview channel.