PostMessage API

The PostMessage API is a way to send messages between the the parent casino window and the experience frontend that is iframed within it.

Casino → Experience

setTheme

{ type: "setTheme", theme: "light" | "dark" | "auto" }

Whenever the casino user changes their preferred color scheme, they will send this message to the experience so that it can update its own theme.

If the experience only supports one theme, they can ignore this message.

Experience → Casino

setHeight

{ type: "setHeight", px: number }

The experience can send this message to the casino to set the height (in pixels) of the iframe which prevents scrollbars from appearing.

You can send this message any time your experience's height changes, like on resize.