@jahandco/interactive-sdk
v0.2.0
Published
React-friendly client SDK for Jah and Co titles running inside the sandboxed player iframe.
Readme
@jahandco/interactive-sdk
React-friendly client SDK for Jah and Co titles running inside the sandboxed player iframe.
What it provides
initJahAndCo(options)to connect the singleton bridge client for the current sessiondestroyJahAndCo()to tear down message listeners when a title unmounts or hot reloadsjc.*domain helpers forplayer,multiplayer,ai,commerce, andleaderboard- A small Deep Ocean themed component set:
Button,Panel,Badge,Input, andStack
Usage
import { initJahAndCo, destroyJahAndCo, jc } from "@jahandco/interactive-sdk";
initJahAndCo({
gameId: "oathbreakers",
sessionToken: "session-token-from-host",
});
const profile = await jc.player.getProfile();
destroyJahAndCo();Notes
- This SDK is browser-only because it uses
window.postMessage()to communicate with the host shell. - Re-initializing the SDK now tears down the previous bridge client first, which avoids duplicate listeners during repeated setup.
