Skip to content

types, errors and size

Every type is exported from the package root. The IIFE has the same shapes at runtime without the names.

TypePage
FiludiSdkThe shape of sdk and of window.FiludiSDK
InitOptions, InitResult, MockConfig, HostName, Features, Policy, AgeBandinit
AdResult, AdsAvailabilityads
SaveRead<T>, SaveWritesave
Period, LeaderboardEntry, SubmitResult, TopResult, MeResultleaderboard
Playerplayer
TrackPropstrack
HostEvents, Consent, Device, Offhost events, fullscreen and device
HostExtras, CrazygamesExtras, PokiExtras, PlaygamaExtrashost extras
FiludiInit, Adapter, AdapterContext, AdapterEvent, AdapterInit, AdKind, ParentMessage, RemoteSaveWrite, ScoreSubmission, Session, SignedScore, TrackEventThe handshake and the adapter contract, for a hub or a host implementation, not for a game

Typed wrappers

import { sdk, version } from '@filudi/game-sdk';
console.log(`Filudi SDK ${version}`);
// Without a bundler: window.FiludiSDK.version

Nothing throws after init(). Failures are statuses on the result: unavailable, rejected, conflict, too-large, error. The programming errors that throw: a method called before init() was called at all, and player.get(), ads.available(), i18n.locale() or device() called before init() resolved.

init({ debug: true }) or ?filudi_debug=1 on the page URL logs every call and every host message to the console with the prefix [filudi-sdk]. Leave it off in a release.

Debug logging

await sdk.init({ gameId: 'gloop', debug: location.hostname === 'localhost' });

Last two versions of Chrome, Firefox, Safari and Edge; iOS 16 and later. Signed scores need crypto.subtle; without it submit returns rejected with reason signature and everything else works. No eval, no document.write, no inline script: the SDK runs under the script-src 'self' policy of the bundle route.

Two builds, 12 kB gzipped each on every host path:

  • ESM, dist/index.js: the core, the filudi adapter and the standalone adapter in the entry; the portal adapters and the rich mock as chunks loaded with import() when that host is detected.
  • IIFE, dist/filudi-sdk.iife.js: one file with the core, filudi, standalone and the three portal adapters, as window.FiludiSDK plus FiludiSDK.version. No rich mock: host mock behaves as standalone.

Each release lists its changes in the package’s changelog on npmjs.com. Pin the exact version and read the changelog before moving.