13. Fullscreen
Sometimes it's preferred to enter fullscreen mode to provide players a better experience. Since the game executes inside an iframe, by using standard web APIs, the iframe element will be promoted to the very front causing many functionalities such as floating ball, announcement, advertisement, etc. to be covered by the fullscreen element.
The SDK provides replacements for the standard fullscreen web APIs.
※ This function is available since SDK version 3.1.2
13.1. Enter fullscreen mode
Developers calling requestFullscreen()
to enter fullscreen mode.
13.1.1. Description
The enter fullscreen function is executed asynchronously and return a Promise object.
13.1.2. Enter fullscreen API
wakool.requestFullscreen();
Example
wakool.requestFullscreen().then(function(){
console.log('Fullscreen mode entered.');
});
13.2. Exit fullscreen mode
Developers calling exitFullscreen()
to leave fullscreen mode.
13.2.1. Description
The exit fullscreen function is executed asynchronously and return a Promise object.
13.2.2. Exit fullscreen API
wakool.exitFullscreen();
Example
wakool.exitFullscreen().then(function(){
console.log('Fullscreen mode exited.');
});
13.3. Current fullscreen mode
Developers calling isFullscreen()
to tell whether currently is in fullscreen mode or not.
13.3.1. Description
The function returns a boolean
, true
if currently is in fullscreen mode, false
otherwise.
13.3.2. Current fullscreen mode API
wakool.isFullscreen();
Example
if (wakool.isFullscreen()) {
console.log('In fullscreen mode');
}
else {
console.log('Not in fullscreen mode');
}