JavaScript SDKAPI Reference
API Overview
All Gamebeast services are properties on the SDK instance: configs, markers, experiments and cohorts.
Every service is a property on the instance you created, in both the browser and on servers:
import { GamebeastClient } from "@gamebeast/sdk/client";
const gamebeast = new GamebeastClient({ apiKey: "abcd-efgh-1234-5678" });
gamebeast.markers.send("example_marker", { value: 42 });| Service | Browser (GamebeastClient) | Server (GamebeastServer) |
|---|---|---|
| Configs | Values evaluated for the current user | Base values, plus evaluate for any user |
| Markers | Attributed to the current user and session | Attributed to the user you pass, or to the server |
| Experiments | The current user's assignments | Active experiments, plus bulk assignment |
| Cohorts | Is the current user a member? | Membership for any user, or many at once |
The two entry points differ where it matters, so each page has a section per entry point, marked like this:
ClientServer
All public types are exported for TypeScript users:
import type { ClientConfigs, ConfigPath, JsonValue } from "@gamebeast/sdk/client";
import type { EvaluatedConfiguration, ServerConfigs } from "@gamebeast/sdk/server";Unsubscribing
Methods that register a callback (observe, onChanged, onReady, onAssignmentsChanged) return an Unsubscribe function. Call it to stop receiving callbacks, for example when a component unmounts:
useEffect(
() => gamebeast.configs.observe("game-settings.Banner", (banner) => setBanner(banner)),
[]
);A callback that throws is logged and never stops other callbacks from running.