b14b876d50
* refactor: replace Array.prototype.forEach.call with plain for-of * fix: add missing contextIsolation: false * fix: open links in default browser
30 lines
595 B
JavaScript
30 lines
595 B
JavaScript
const { BrowserWindow, app, screen, ipcMain } = require('electron')
|
|
|
|
let mainWindow = null
|
|
|
|
ipcMain.handle('get-screen-size', () => {
|
|
return screen.getPrimaryDisplay().workAreaSize
|
|
})
|
|
|
|
function createWindow () {
|
|
const windowOptions = {
|
|
width: 600,
|
|
height: 300,
|
|
title: 'Take a Screenshot',
|
|
webPreferences: {
|
|
contextIsolation: false,
|
|
nodeIntegration: true
|
|
}
|
|
}
|
|
|
|
mainWindow = new BrowserWindow(windowOptions)
|
|
mainWindow.loadFile('index.html')
|
|
|
|
mainWindow.on('closed', () => {
|
|
mainWindow = null
|
|
})
|
|
}
|
|
|
|
app.whenReady().then(() => {
|
|
createWindow()
|
|
})
|