29 lines
800 B
JavaScript
29 lines
800 B
JavaScript
import { app, BrowserWindow } from 'electron';
|
|
|
|
// A helper function for creating the window
|
|
const createWindow = () => {
|
|
const win = new BrowserWindow({
|
|
width: 290,
|
|
height: 465,
|
|
resizable: false,
|
|
autoHideMenuBar: true,
|
|
useContentSize: true,
|
|
});
|
|
|
|
win.loadFile('static/index.html');
|
|
};
|
|
|
|
app.whenReady().then(() => {
|
|
createWindow();
|
|
|
|
// This event works on macOS only.
|
|
// If the user clicks on app's icon on the dock and there are no open windows, create one.
|
|
app.on('activate', () => {
|
|
if (BrowserWindow.getAllWindows().length === 0) createWindow();
|
|
});
|
|
});
|
|
|
|
// If all windows are closed and we're not running macOS, quit the app.
|
|
app.on('window-all-closed', () => {
|
|
if (process.platform !== 'darwin') app.quit();
|
|
}); |