Page Summary
-
GameSnacks partner SDK can be implemented in both JavaScript and HTML files.
-
The
createGameSnacksfunction is used to initialize the Game Center. -
Several interfaces are available for controlling different aspects like audio, game lifecycle, score, and storage.
For example, in a JS file:
import {createGameSnacks} from 'https://sdks.gamesnacks.com/partner-v1.js';
// Create GameSnacks Game Center.
const gamesnacks = createGameSnacks('iframe-id', 'my-game-center');
// Register API callbacks.
gamesnacks.game.onReady(...);
gamesnacks.audio.update(...);
// Initialise GameSnacks.
await gamesnacks.init();
Or, in an HTML file:
<script src="https://sdks.gamesnacks.com/partner-v1.js"></script>
<script>
// Create Snacks Game Center.
const gamesnacks = window.createGameSnacks('iframe-id', 'my-game-center');
// Register API callbacks.
gamesnacks.game.onReady(...);
gamesnacks.audio.update(...);
// Initialise GameSnacks.
await gamesnacks.init();
</script>
Interfaces
| Name | Description |
|---|---|
Audio |
Audio controls and events. |
Game |
Game lifecycle events. |
GameSnacks |
GameSnacks partner SDK. |
Page |
Page lifecycle events. |
Score |
Score controls and events. |
Storage |
Storage controls and events. |
UserActivity |
User activity events. |
Functions
| Name | Description |
|---|---|
createGameSnacks(iframe,
gameCenterId,
gameId) |
Creates an embedded GameSnacks Game Center. |