Skip to content

Instantly share code, notes, and snippets.

@watilde
Created January 12, 2017 23:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save watilde/c47eba263e6048c93ebf7c90a5e60c00 to your computer and use it in GitHub Desktop.
Save watilde/c47eba263e6048c93ebf7c90a5e60c00 to your computer and use it in GitHub Desktop.
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