forked from dustinblackman/Championify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathelectron.js
38 lines (31 loc) · 995 Bytes
/
electron.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { app, BrowserWindow } from 'electron';
import fs from 'fs';
import path from 'path';
import R from 'ramda';
// Used for Squirrel install on Windows
if (require('electron-squirrel-startup')) app.quit();
const dev_enabled = process.env.NODE_ENV === 'development' || fs.existsSync('./dev_enabled') || fs.existsSync(path.join(__dirname, '..', 'dev_enabled'));
let main_window = null;
app.on('window-all-closed', () => {
app.quit();
});
app.on('ready', () => {
main_window = new BrowserWindow({
fullscreen: false,
width: 450,
height: 670,
center: true,
resizable: false,
show: false,
frame: false,
title: 'Championify'
});
main_window.loadURL(`file://${__dirname}/index.html`);
if (dev_enabled) main_window.openDevTools({detach: true});
main_window.webContents.on('did-finish-load', () => {
if (!R.contains('--autorun', process.argv)) return main_window.show();
});
main_window.on('closed', () => {
main_window = null;
});
});