Turbostars – Sportsbook Modules
The Turbostars Sportsbook Modules integration provides seamless access to Sportsbook functionality through the Operator Games API SDK.
It uses automatic parameter injection, where the getModules() API leverages a JavaScript Proxy to automatically include host, cid, and token in all module method calls.
This design keeps the integration simple, future-proof, and type-safe, as developers only need to provide parameters specific to their use case, while new Sportsbook methods are supported automatically without requiring any SDK updates.
How It Works?
When you call provider.getModules(), the SDK returns a proxied version of window.Sportsbook.
This proxy automatically injects shared parameters (host, cid, and token) from your SDK configuration into every method call, leaving you to focus only on game- or event-specific logic.
Auto-Injection Flow
Usage
Basic Setup
// Initialize the SDK
const sdk = await Hub88Games.init({
provider_token: 'YOUR_TOKEN',
partner_key: 'YOUR_PARTNER_KEY',
launcher_base_url: 'https://launcher.example.com'
});
// Get the provider instance
const provider = sdk.getProviderInstance();
// Retrieve modules with auto-injection enabled
const modules = provider.getModules();Available Module Methods
1. Bet slip Count Tracking
Tracks the number of bets in the user’s bet slip.
Parameter
Type
Required
Description
onChange
function
Yes
Callback function triggered when the betslip count changes.
Auto-Injected Parameters: host, cid, token
2. Categorizer Data Subscription
Subscribes to updates in the categorizer data (sports/esports navigation).
onChange
function
Yes
Callback receiving categorizer data updates.
sportsbookPath
string
No
Current sportsbook route for contextual data.
isShowCategorizerInSportsbook
boolean
No
Keep categorizer visible within sportsbook (default: false).
lang
string
No
Language code (ISO 639-1), e.g., en, es.
Auto-Injected Parameters: host, cid, token
3. Get Tournaments by Discipline
Retrieves tournament data for a specific discipline (e.g., Dota 2, CS:GO, LoL).
disciplineId
string
Yes
The discipline ID (dota2, csgo, lol).
sportsbookPath
string
No
Optional route path for correct URL generation.
lang
string
No
Language code for data localization.
Auto-Injected Parameters: host, cid, token
Future Method Support
The SDK uses dynamic proxying, so any new Sportsbook module methods introduced by Turbostars or future providers will work automatically, no SDK upgrade required.
TypeScript Types
Best Practices
Call getModules() After Initialization
Ensure the SDK and provider are fully initialized before requesting modules.
Reuse the Same Modules Instance
Avoid redundant getModules() calls for better performance.
Handle Errors Gracefully
Use try/catch to capture initialization or communication errors.
Last updated
Was this helpful?

