diff --git a/CHANGELOG.md b/CHANGELOG.md index c76d0362..df710e02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## Unpublished + +### Updated +- Force fullscreen when kioskmode is active. + ## [2.0.4] - 2016-08-07 ### Added diff --git a/js/electron.js b/js/electron.js index 0a72aee9..1a3ddb64 100644 --- a/js/electron.js +++ b/js/electron.js @@ -1,3 +1,5 @@ +/* jshint esversion: 6 */ + "use strict"; const Server = require(__dirname + "/server.js"); @@ -28,17 +30,31 @@ function createWindow() { mainWindow.loadURL("http://localhost:" + config.port); // Open the DevTools if run with "npm start dev" - if(process.argv[2] == "dev"){ + if(process.argv[2] == "dev") { mainWindow.webContents.openDevTools(); } - // Emitted when the window is closed. + // Set responders for window events. mainWindow.on("closed", function() { - // Dereference the window object, usually you would store windows - // in an array if your app supports multi windows, this is the time - // when you should delete the corresponding element. mainWindow = null; }); + + if (config.kioskmode) { + mainWindow.on("blur", function() { + mainWindow.focus(); + }); + + mainWindow.on("leave-full-screen", function() { + // console.log("leave-full-screen"); + mainWindow.setFullScreen(true); + }); + + mainWindow.on("resize", function() { + setTimeout(function() { + mainWindow.reload(); + }, 1000); + }); + } } // This method will be called when Electron has finished @@ -50,11 +66,7 @@ app.on("ready", function() { // Quit when all windows are closed. app.on("window-all-closed", function() { - // On OS X it is common for applications and their menu bar - // to stay active until the user quits explicitly with Cmd + Q - if (process.platform !== "darwin") { - app.quit(); - } + createWindow(); }); app.on("activate", function() {