UNPKG

histoire

Version:

A fast story book powered by Vite

10 lines (9 loc) • 622 B
import { SANDBOX_READY, VARIANT_READY } from '@histoire/shared'; /** Pure guard reused by generated host script and focused boundary tests. */ export function matchesPreviewMessage(event, frame, authority, identity, types = [SANDBOX_READY, VARIANT_READY]) { return authority.active && authority.nonce === identity.nonce && authority.epoch === identity.epoch && event.source === frame && event.origin === authority.origin && event.data?.__histoire === true && types.includes(event.data.type) && event.data.storyId === authority.storyId && event.data.variantId === authority.variantId; }