-
-
Save watilde/c47eba263e6048c93ebf7c90a5e60c00 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const electron = require('electron') | |
const app = electron.app | |
const BrowserWindow = electron.BrowserWindow | |
const path = require('path') | |
const url = require('url') | |
let mainWindow | |
function createWindow () { | |
mainWindow = new BrowserWindow({width: 800, height: 600}) | |
mainWindow.loadURL(url.format({ | |
pathname: path.join(__dirname, 'index.html'), | |
protocol: 'file:', | |
slashes: true, | |
})) | |
// fullscreen state will be keeped if you add the following line | |
// mainWindow.setFullScreen(true); | |
setTimeout(function () { | |
mainWindow.setKiosk(true); | |
}, 1000); | |
setTimeout(function () { | |
mainWindow.setKiosk(false); | |
}, 2000); | |
mainWindow.webContents.openDevTools() | |
mainWindow.on('closed', function () { | |
mainWindow = null | |
}) | |
} | |
app.on('ready', createWindow) | |
app.on('window-all-closed', function () { | |
if (process.platform !== 'darwin') { | |
app.quit() | |
} | |
}) | |
app.on('activate', function () { | |
if (mainWindow === null) { | |
createWindow() | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment