I am using visibilitychange
event of browser. All looks good.
After clicking on one of my buttons, I use fullScreen API
to take website into fullscreen mode.
The issue that I have is visibilitychange
event gets called twice when getting into fullscreen
mode and when I exit fullscreen mode, visibilitychange
gets called 4 times . Is there any reason why this is happening? Isn't there any way that it will only get called once ?
this.visibility = () => {
console.log("this gets called multiple times ");
}
document.addEventListener('visibilitychange', this.visibility, false);