作る

Funnable

Facade that wires together every browser capability exposed by the Funnable SDK. Use `Funnable.init` inside an embedded game to hydrate runtime config and access chat, lobby, ranking, storage, and analytics helpers.

Funnable

Facade that wires together every browser capability exposed by the Funnable SDK. Use Funnable.init inside an embedded game to hydrate runtime config and access chat, lobby, ranking, storage, and analytics helpers.

Examples

import { Funnable } from "@fun-sdk/core";
 
const fun = Funnable.init();
fun.chat.connect(lobbyId, token);
fun.ranking.submitScore(playerScore);
fun.analytics.trackEvent("level_complete", { level: 5 });

Members

config

config: FunnableConfig

Runtime settings injected by the container.

chat

chat: FunnableChat

Chat helper scoped to the current game.

ranking

ranking: FunnableRanking

Leaderboard helper scoped to the current game.

lobby

lobby: FunnableLobby

Lobby helper for creating/joining multiplayer rooms.

storage

storage: FunnableStorage

Local storage namespaced with the game id.

analytics

analytics: FunnableAnalytics

Lightweight analytics reporter that uses navigator.sendBeacon.

init

static init(overrides?: Partial<FunnableConfig>): Funnable

Creates a fully wired SDK instance. Automatically merges the injected window.__FUNNABLE__ object with any overrides, which makes it easy to stub values in local development.

Examples

const fun = Funnable.init({ gameId: "local-dev" });
fun.storage.set("difficulty", "hard");