Skip to main content

HTML5 SDK

This section describes the Jest HTML5 SDK and how to integrate it into your web-based app or game.

SDK initialization​

  1. Open your app's index.html file in your favorite code editor.

  2. Add the Jest platform script before the closing </head> tag:

    <script src="https://cdn.jest.com/sdk/latest/jestsdk.js"></script>
  3. Initialize the Jest SDK before calling any other SDK methods.

    // Initialize Jest
    JestSDK.init().then(() => {
    // initialized
    });

    or using async / await:

    // Initialize Jest
    await JestSDK.init();

Init options​

JestSDK.init() accepts an optional configuration object:

OptionTypeDefaultDescription
autoLoginRemindersbooleantrueWhen set to false, disables the automatic login reminder popups that appear at escalating intervals for guest players. Manual login via JestSDK.login() is unaffected.
// Disable automatic platform login reminders
await JestSDK.init({ autoLoginReminders: false });

TypeScript types​

The SDK runtime comes from the CDN, and the types come from npm:

npm install --save-dev @jest-com/types

TypeScript auto-loads types only from node_modules/@types/*, so name the package in your tsconfig.json:

{
"compilerOptions": {
"types": ["vite/client", "@jest-com/types"]
}
}

List every type package you rely on. A types array replaces TypeScript's automatic inclusion, so anything left out of it stops being picked up.

To avoid managing that list, add a .d.ts under your source root instead. Vite projects already have src/vite-env.d.ts for this:

/// <reference types="vite/client" />
/// <reference types="@jest-com/types" />

Either way, JestSDK and window.JestSDK are typed globals in every file. Named types are exported for your own signatures:

import type { Jest, PlayerProfile, SubscriptionData } from "@jest-com/types";

Using the SDK​

The remainder of this guide walks through the SDK's modules and how to use them in your app.

This includes responding to app lifecycle events, retrieving player data and authenticating players, passing data into your app, scheduling and managing notifications, and using in-app payments. It also includes sharing your app with referral links and tracking conversions, controlling the platform loading screen, and redirecting players between your team's apps.