I am new to localStorage in html5, and am having some difficulties with the syntax. I am basically trying to check the value of checkFullscreen, and run some commands depending on true or false. But it's not working. What am I doing wrong, and could you provide me with a way in fixing this.
(The win.isFullscreen, win.leaveFullscreen(), win.enterFullscreen() are part of node.js)
Thank-you.
var fullscreenstore = localStorage.getItem('fullscreen');
var checkFullscreen = win.isFullscreen;
if (fullscreenstore == null || true) { // if value is null or true then fullscreen app
localStorage.setItem(fullscreen, true);
win.enterFullscreen();
win.maximize();
win.show();
}
else { // if false then run in window mode and set localStorage value false
localStorage.setItem(fullscreen, false);
win.maximize();
win.show();
}
Then on pressing the 'F1' key to change the value of the localStorage value.
$(document).keyup(function (e) {
if (e.which == 27) {
win.close();
};
if (e.which == 112) {
if (checkFullscreen == true) {
win.leaveFullscreen();
}
else {
win.enterFullscreen();
};
};
});