I got a page where is checking if the user left the fullscreen. I want to delete/destroy this event watcher but could not find out how i can do this on the description API Description Here is my code:
//create black background and disable scrolling
$rootScope.fullScreen = !$rootScope.fullScreen;
//make div fullScreen (Browser Native)
if($rootScope.fullScreen == true) {
var videoWindow = document.getElementById("full-screen");
if (videoWindow.requestFullscreen) {
videoWindow.requestFullscreen();
}
//check if user has closed fullscreen
document.onwebkitfullscreenchange = function ( event ) {
if(!document.webkitFullscreenElement) {
$rootScope.fullScreen = false;
//REMOVE THE EVENTHANDLER - STOP WATCHING!
?????????
}
};
What is your intention on removing the event?
document.onwebkitfullscreenchange = null;
should work.