Commit f7378ac4d407017d4af16963c5d62628bdc80059
1 parent
ce26c30d51
Exists in
master
full screen electron, no bar
Showing
1 changed file
with
6 additions
and
3 deletions
Show diff stats
main.js
| 1 | const { app, BrowserWindow } = require('electron') | 1 | const { app, BrowserWindow } = require('electron') |
| 2 | require('electron-debug')({ showDevTools: true }); | 2 | require('electron-debug')({ showDevTools: true }); |
| 3 | const path = require('path') | 3 | const path = require('path'); |
| 4 | const url = require('url') | 4 | const url = require('url'); |
| 5 | 5 | ||
| 6 | let win; | 6 | let win; |
| 7 | 7 | ||
| 8 | function createWindow () { | 8 | function createWindow () { |
| 9 | // Create the browser window. | 9 | // Create the browser window. |
| 10 | win = new BrowserWindow({ | 10 | win = new BrowserWindow({ |
| 11 | width: 600, | 11 | width: 600, |
| 12 | height: 600, | 12 | height: 600, |
| 13 | backgroundColor: '#ffffff', | 13 | backgroundColor: '#ffffff', |
| 14 | icon: `file://${__dirname}/www/assets/logo.png` | 14 | icon: `file://${__dirname}/www/assets/logo.png`, |
| 15 | fullscreen: true | ||
| 15 | }) | 16 | }) |
| 16 | 17 | ||
| 17 | win.loadURL(url.format({ pathname: path.join(__dirname, '/www/index.html'), protocol: 'file:', slashes: true })) | 18 | win.loadURL(url.format({ pathname: path.join(__dirname, '/www/index.html'), protocol: 'file:', slashes: true })) |
| 18 | 19 | ||
| 19 | // Event when the window is closed. | 20 | // Event when the window is closed. |
| 20 | win.on('closed', function () { | 21 | win.on('closed', function () { |
| 21 | win = null | 22 | win = null |
| 22 | }) | 23 | }) |
| 24 | |||
| 25 | win.removeMenu(); | ||
| 23 | } | 26 | } |
| 24 | 27 | ||
| 25 | // Create window on electron intialization | 28 | // Create window on electron intialization |
| 26 | app.on('ready', createWindow) | 29 | app.on('ready', createWindow) |
| 27 | 30 | ||
| 28 | // Quit when all windows are closed. | 31 | // Quit when all windows are closed. |
| 29 | app.on('window-all-closed', function () { | 32 | app.on('window-all-closed', function () { |
| 30 | 33 | ||
| 31 | // On macOS specific close process | 34 | // On macOS specific close process |
| 32 | if (process.platform !== 'darwin') { | 35 | if (process.platform !== 'darwin') { |
| 33 | app.quit() | 36 | app.quit() |
| 34 | } | 37 | } |
| 35 | }) | 38 | }) |
| 36 | 39 | ||
| 37 | app.on('activate', function () { | 40 | app.on('activate', function () { |
| 38 | // macOS specific close process | 41 | // macOS specific close process |
| 39 | if (win === null) { | 42 | if (win === null) { |
| 40 | createWindow() | 43 | createWindow() |
| 41 | } | 44 | } |
| 42 | }); | 45 | }); |
| 43 | 46 |