9. Fullscreen
Entering fullscreen mode can sometimes enhance the player experience. However, since the game runs inside an iframe, using standard web APIs to enter fullscreen will bring the iframe element to the forefront, which may cover other functionalities like floating balls, announcements, and advertisements.
The SDK provides replacements for the standard fullscreen web APIs.
9.1. Enter fullscreen mode
Developers calling wakool.requestFullscreen() to enter fullscreen mode.
9.1.1. Description
The enter fullscreen function is executed asynchronously and return a Promise object.
9.1.2. Enter fullscreen API
wakool.requestFullscreen();
9.1.3. Example
await wakool.requestFullscreen();
console.log('Fullscreen mode entered.');
9.2. Exit fullscreen mode
Developers calling wakool.exitFullscreen() to leave fullscreen mode.
9.2.1. Description
The exit fullscreen function is executed asynchronously and return a Promise object.
9.2.2. Exit fullscreen API
wakool.exitFullscreen();
9.2.3. Example
await wakool.exitFullscreen();
console.log('Fullscreen mode exited.');
9.3. Current fullscreen mode
Developers calling wakool.isFullscreen() to tell whether currently is in fullscreen mode or not.
9.3.1. Description
The function returns a boolean, true if currently is in fullscreen mode, false otherwise.
9.3.2. Current fullscreen mode API
wakool.isFullscreen();
9.3.3. Example
if (await wakool.isFullscreen()) {
console.log('In fullscreen mode');
}
else {
console.log('Not in fullscreen mode');
}