Loading...
Loading...
Integrates the Poki JavaScript SDK (PokiSDK) into JavaScript browser games. Initializes PokiSDK, configures interstitial and rewarded ad breaks (commercialBreak, rewardedBreak), manages gameplay lifecycle events (gameplayStart, gameplayStop), and sets up loading progress tracking (gameLoadingFinished). Use when the user mentions Poki, PokiSDK, web game monetization, game portal integration, ad breaks in browser games, or distributing an HTML5 game on the Poki platform.
npx skill4agent add hungify/playables-skills poki-js-sdkPokiSDK.init()gameLoadingFinishedgameplayStartgameplayStopcommercialBreakrewardedBreakhttps://inspector.poki.io<script src="https://game-cdn.poki.com/scripts/v2/poki-sdk.js"></script>function loadPokiSdk() {
return new Promise((resolve, reject) => {
const script = document.createElement('script');
script.src = 'https://game-cdn.poki.com/scripts/v2/poki-sdk.js';
script.onload = resolve;
script.onerror = reject;
document.head.appendChild(script);
});
}loadPokiSdk()
.then(() => window.PokiSDK.init())
.then(() => {
// SDK is ready
window.PokiSDK.gameLoadingFinished();
})
.catch(() => {
// SDK init failed - continue without Poki integration
window.PokiSDK && window.PokiSDK.gameLoadingFinished();
});gameLoadingFinishedgameLoadingStartgameLoadingFinishedisOpenedfunction showInterstitial() {
let isOpened = false;
window.PokiSDK.commercialBreak(() => {
isOpened = true;
// Pause game, mute audio
})
.then(() => {
if (isOpened) {
// Resume game, unmute audio
} else {
// Ad was not shown
}
})
.catch(() => {
// Ad request failed
});
}rewardedBreakisOpenedfunction showRewarded() {
let isOpened = false;
window.PokiSDK.rewardedBreak(() => {
isOpened = true;
// Pause game, mute audio
})
.then((success) => {
if (isOpened) {
if (success) {
// Grant reward to the player
}
// Resume game, unmute audio
} else {
// Ad was not shown
}
})
.catch(() => {
// Ad request failed
});
}gameplayStartgameplayStopgameplayStartgameplayStopfunction onLevelStart() {
window.PokiSDK.gameplayStart();
}
function onLevelEnd() {
window.PokiSDK.gameplayStop();
}https://inspector.poki.ioinitgameLoadingFinishedcommercialBreakrewardedBreakgameplayStartgameplayStophappyTimegameInteractive