actual/packages/desktop-electron/about.js

32 lines
675 B
JavaScript
Raw Normal View History

2022-04-29 02:44:38 +00:00
const isDev = require('electron-is-dev');
const { BrowserWindow } = require('electron');
let window;
function openAboutWindow() {
if (window != null) {
window.focus();
return window;
}
window = new BrowserWindow({
width: 290,
height: process.platform === 'win32' ? 255 : 240,
show: true,
resizable: isDev,
webPreferences: {
nodeIntegration: true,
contextIsolation: false
}
});
window.setBackgroundColor('white');
window.setTitle('');
window.loadURL(`file://${__dirname}/about/about.html`);
window.once('closed', () => {
window = null;
});
}
module.exports = { openAboutWindow, getWindow: () => window };