Skip to content

Function: isEmbedProtocolMessage()

ts
function isEmbedProtocolMessage(value: unknown): value is EmbedProtocolMessage;

Whether value looks like a message in this protocol.

A message listener receives every post to the window, including a host's unrelated traffic and other embeds', so both ends need to reject foreign shapes before switching on type. This validates both the message name and its payload before narrowing: postMessage is runtime input, so a TypeScript union alone cannot make a malformed message safe.

Parameters

ParameterType
valueunknown

Returns

value is EmbedProtocolMessage

Ridge AI