1 | const {
|
2 | app,
|
3 | BrowserWindow
|
4 | } = require('electron')
|
5 | const path = require('path')
|
6 | const url = require('url')
|
7 |
|
8 | let win
|
9 |
|
10 | function createWindow () {
|
11 | win = new BrowserWindow({
|
12 | width: 1024,
|
13 | height: 800
|
14 | })
|
15 |
|
16 | win.loadURL(url.format({
|
17 | pathname: path.resolve(process.cwd(), './coverage/lcov-report/index.html'),
|
18 | protocol: 'file:',
|
19 | slashes: true
|
20 | }))
|
21 |
|
22 |
|
23 |
|
24 | win.on('closed', () => {
|
25 | win = null
|
26 | })
|
27 | }
|
28 |
|
29 | app.on('ready', createWindow)
|
30 |
|
31 |
|
32 | app.on('window-all-closed', () => {
|
33 | if (process.platform !== 'darwin') {
|
34 | app.quit()
|
35 | }
|
36 | app.exit(1)
|
37 | })
|
38 |
|
39 | app.on('activate', () => {
|
40 | if (win === null) {
|
41 | createWindow()
|
42 | }
|
43 | })
|