function
connectLivePreview
Connect a frontend preview window or iframe to authenticated admin updates.
Arguments
| Argument | Type | Description |
|---|---|---|
__0 | { adminOrigin: string; target: LivePreviewTarget; onUpdate: (message: RiduLivePreviewUpdateMessage< | The __0 value. |
Returns
The declared result.
LivePreviewConnection<Data>How it works
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.
Full signature
function connectLivePreview<Data extends object>(
{
adminOrigin, target: expectedTarget, onUpdate, window: injectedWindow,
}: {
adminOrigin: string
target: LivePreviewTarget
onUpdate: (message: RiduLivePreviewUpdateMessage<
Data
>) => void
window?: object
},
): LivePreviewConnection<Data>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.