| 8 | let win; |
| 9 | |
| 10 | function createWindow () { |
| 11 | win = new BrowserWindow({ |
| 12 | width: 1024, |
| 13 | height: 900, |
| 14 | backgroundColor: '#1c1f24', |
| 15 | show: true, |
| 16 | title: 'Festify', |
| 17 | webPreferences: { |
| 18 | nativeWindowOpen: false |
| 19 | } |
| 20 | }); |
| 21 | |
| 22 | win.loadURL(url.format({ |
| 23 | pathname: path.join(__dirname, 'www', 'app.html'), |
| 24 | protocol: 'file:', |
| 25 | slashes: true |
| 26 | })); |
| 27 | startSpotify() |
| 28 | .catch(() => win.loadURL(url.format({ |
| 29 | pathname: path.join(__dirname, 'www', 'spotify-missing.html'), |
| 30 | protocol: 'file:', |
| 31 | slashes: true |
| 32 | }))); |
| 33 | |
| 34 | win.once('ready-to-show', () => win.focus()); |
| 35 | win.on('closed', () => win = null); |
| 36 | } |
| 37 | |
| 38 | app.on('ready', () => { |
| 39 | createWindow(); |