Loader
GET https://<game server>/element/v1/loader.js answers a JavaScript module built from your casino’s settings. It is revalidated on every page load, so a page sees saved changes on its next load; a page already open keeps what it loaded. The game files it imports are content-hashed and cached for a year.
config
connect(element, options)
connect() writes your saved theme as inline --og-* tokens on the element, unless the element already has that token inline, then binds the element to a connection for the token’s player and currency. It resolves before the connection opens, to:
client: the page’s connection for this player and currency, shared by every element of that player and currency.disconnect(): unbinds the element. When no element of that player and currency is left, it closes the connection.
undefined after it passed the failure to onError:
Attributes
stats and fairness are read when the element builds its view. The game IDs are mines, plinko, dice, limbo, crash, roulette, keno, baccarat, wheel, pump, diamonds, hilo and blackjack. See Games.
Properties and methods
Available once the tag is defined, for example afterawait customElements.whenDefined(config.tag).
The loader drives the element’s other members, such as
setState() and present(), for you. Calling them from your page conflicts with it.
Events
All events bubble and cross the shadow boundary.
The
og-intent actions are bet, configure, start-auto, stop-auto, amount-half, amount-double, stats, fairness, and each game’s own: Mines reveal, cashout and random-tile; Crash cashout; Keno quick-pick; Pump pump and cashout; HiLo higher, lower, same, skip and cashout; Blackjack hit, stand, double, split, insure and decline.
The connection’s client
client is the page’s connection to your game server for one player and currency.
Styling
Set--og-* tokens on the element, an ancestor or :root. The element reads them when it builds its view and whenever its style or class changes; after changing a token on an ancestor, call refreshTheme(). Colours take any CSS colour the browser resolves; transparency is dropped.
When a colour you set would make text hard to read, the element moves its lightness until the pair reaches its contrast floor, and keeps its hue.
--og-background, --og-surface and --og-accent-bright are used exactly as given.
Precedence
The loader writes your saved theme as inline tokens on the element, except tokens the element already has inline. To override a saved value for one element, set the token inline, in thestyle attribute or with element.style.setProperty(), before connect(), or call applyTheme(). A stylesheet rule loses to an inline token unless it is !important.
Shadow parts
Style inside the element with::part(), for example og-game::part(primary-button) { letter-spacing: 0.02em; }.
The Provably fair dialog sits in its own shadow root on
document.body and takes the opening element’s colours, radius and fonts. It exposes no parts.
Fonts
The element ships Geist and Geist Mono and loads them from your game server, so it contacts no font service. Setting--og-font or --og-font-numeric before the element connects skips the bundled face. The fonts you name must be loaded by your page: the element never downloads a font you name.
Browser storage
The element keeps its working state in the player’s browser:sessionStorage, under keys starting withog:, for bets in flight, so a reload does not lose them.- IndexedDB, for the player’s device key and the proofs of their bets.