Skip to content
This repository was archived by the owner on Jan 14, 2022. It is now read-only.

Commit 042e84e

Browse files
committed
fixed eslint
1 parent edc8104 commit 042e84e

File tree

3 files changed

+117
-117
lines changed

3 files changed

+117
-117
lines changed

app/app-main.js

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
1-
const { app, Menu, ipcMain } = require("electron");
1+
const { app, Menu, ipcMain } = require('electron')
22

3-
let mainWindow = null;
3+
let mainWindow = null
44

5-
const gotTheLock = app.requestSingleInstanceLock();
5+
const gotTheLock = app.requestSingleInstanceLock()
66

77
if (!gotTheLock) {
8-
app.quit();
8+
app.quit()
99
} else {
10-
app.on("second-instance", (event, commandLine, workingDirectory) => {
10+
app.on('second-instance', (event, commandLine, workingDirectory) => {
1111
if (mainWindow) {
12-
if (process.platform === "win32") {
13-
mainWindow.minimize();
14-
mainWindow.restore();
12+
if (process.platform === 'win32') {
13+
mainWindow.minimize()
14+
mainWindow.restore()
1515
}
16-
mainWindow.show();
17-
mainWindow.focus();
16+
mainWindow.show()
17+
mainWindow.focus()
1818
}
19-
});
19+
})
2020

21-
app.on("ready", () => {
22-
mainWindow = require("./app-window")(app);
23-
require("./app-tray")(app, mainWindow);
24-
ipcMain.on("bringToFront", () => {
25-
if (process.platform === "win32") {
26-
mainWindow.minimize();
27-
mainWindow.restore();
21+
app.on('ready', () => {
22+
mainWindow = require('./app-window')(app)
23+
require('./app-tray')(app, mainWindow)
24+
ipcMain.on('bringToFront', () => {
25+
if (process.platform === 'win32') {
26+
mainWindow.minimize()
27+
mainWindow.restore()
2828
}
29-
mainWindow.show();
30-
mainWindow.focus();
31-
});
32-
const template = require("./app-menu")(app, mainWindow);
33-
const menu = Menu.buildFromTemplate(template);
29+
mainWindow.show()
30+
mainWindow.focus()
31+
})
32+
const template = require('./app-menu')(app, mainWindow)
33+
const menu = Menu.buildFromTemplate(template)
3434
switch (process.platform) {
35-
case "darwin":
36-
Menu.setApplicationMenu(menu);
37-
break;
38-
case "win32":
39-
mainWindow.setMenu(menu);
40-
break;
41-
case "linux":
42-
Menu.setApplicationMenu(menu);
43-
mainWindow.setMenu(menu);
44-
break;
35+
case 'darwin':
36+
Menu.setApplicationMenu(menu)
37+
break
38+
case 'win32':
39+
mainWindow.setMenu(menu)
40+
break
41+
case 'linux':
42+
Menu.setApplicationMenu(menu)
43+
mainWindow.setMenu(menu)
44+
break
4545
}
46-
});
46+
})
4747

48-
app.on("before-quit", () => {
49-
mainWindow.shouldQuit();
50-
});
48+
app.on('before-quit', () => {
49+
mainWindow.shouldQuit()
50+
})
5151
}

app/app-window.js

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
const electron = require("electron");
2-
const BrowserWindow = electron.BrowserWindow;
3-
const path = require("path");
4-
const Store = require("electron-store");
5-
const store = new Store();
6-
const _ = require("lodash");
1+
const electron = require('electron')
2+
const BrowserWindow = electron.BrowserWindow
3+
const path = require('path')
4+
const Store = require('electron-store')
5+
const store = new Store()
6+
const _ = require('lodash')
77

8-
const showMenu = process.platform !== "win32";
9-
const windowSize = store.get("windowsize") || { width: 1080, height: 720 };
10-
let mainWindow = null;
11-
let isQuitting = false;
8+
const showMenu = process.platform !== 'win32'
9+
const windowSize = store.get('windowsize') || { width: 1080, height: 720 }
10+
let mainWindow = null
11+
let isQuitting = false
1212

13-
function createWindow(app) {
13+
function createWindow (app) {
1414
mainWindow = new BrowserWindow({
1515
width: windowSize.width,
1616
height: windowSize.height,
@@ -20,49 +20,49 @@ function createWindow(app) {
2020
webPreferences: {
2121
zoomFactor: 1.0,
2222
nodeIntegration: true,
23-
blinkFeatures: "OverlayScrollbars"
23+
blinkFeatures: 'OverlayScrollbars'
2424
},
25-
icon: path.resolve(__dirname, "../resources/icon/icon512.png")
26-
});
25+
icon: path.resolve(__dirname, '../resources/icon/icon512.png')
26+
})
2727

28-
const url = "file://" + path.resolve(__dirname, "./index.html");
28+
const url = 'file://' + path.resolve(__dirname, './index.html')
2929

30-
mainWindow.loadURL(url);
31-
mainWindow.on("resize", _.throttle(storeWindowSize, 500));
32-
if (process.env.NODE_ENV === "dev") {
33-
mainWindow.webContents.openDevTools();
30+
mainWindow.loadURL(url)
31+
mainWindow.on('resize', _.throttle(storeWindowSize, 500))
32+
if (process.env.NODE_ENV === 'dev') {
33+
mainWindow.webContents.openDevTools()
3434
}
35-
const screen = electron.screen.getPrimaryDisplay();
35+
const screen = electron.screen.getPrimaryDisplay()
3636
if (
3737
windowSize.width >= screen.size.width &&
3838
windowSize.height >= screen.size.height - 1
3939
) {
40-
mainWindow.maximize();
40+
mainWindow.maximize()
4141
}
4242
// prevent the app from quitting
43-
mainWindow.on("close", e => {
43+
mainWindow.on('close', e => {
4444
if (!isQuitting) {
45-
e.preventDefault();
46-
mainWindow.blur();
47-
if (process.platform === "darwin") {
48-
app.hide();
45+
e.preventDefault()
46+
mainWindow.blur()
47+
if (process.platform === 'darwin') {
48+
app.hide()
4949
} else {
50-
mainWindow.hide();
50+
mainWindow.hide()
5151
}
5252
}
53-
});
53+
})
5454

55-
mainWindow.shouldQuit = function() {
56-
isQuitting = true;
57-
};
55+
mainWindow.shouldQuit = function () {
56+
isQuitting = true
57+
}
5858

59-
return mainWindow;
59+
return mainWindow
6060
}
6161

62-
function storeWindowSize() {
62+
function storeWindowSize () {
6363
try {
64-
store.set("windowsize", mainWindow.getBounds());
64+
store.set('windowsize', mainWindow.getBounds())
6565
} catch (e) {}
6666
}
6767

68-
module.exports = createWindow;
68+
module.exports = createWindow

scripts/dev.js

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,73 @@
1-
process.env.NODE_ENV = "dev";
2-
const webpack = require("webpack");
3-
const WebpackDevServer = require("webpack-dev-server");
4-
const config = require("./webpack.config");
5-
const signale = require("signale");
6-
const { spawn } = require("child_process");
7-
const electron = require("electron");
8-
const port = 8000;
9-
let server = null;
1+
process.env.NODE_ENV = 'dev'
2+
const webpack = require('webpack')
3+
const WebpackDevServer = require('webpack-dev-server')
4+
const config = require('./webpack.config')
5+
const signale = require('signale')
6+
const { spawn } = require('child_process')
7+
const electron = require('electron')
8+
const port = 8000
9+
let server = null
1010

1111
const options = {
1212
publicPath: config.output.publicPath,
1313
hot: true,
1414
inline: true,
1515
quiet: true,
16-
sockHost: "localhost",
16+
sockHost: 'localhost',
1717
sockPort: port
18-
};
18+
}
1919

20-
function startServer() {
21-
config.plugins.push(new webpack.HotModuleReplacementPlugin());
22-
config.entry.main.unshift("webpack/hot/dev-server");
23-
const compiler = webpack(config);
24-
server = new WebpackDevServer(compiler, options);
20+
function startServer () {
21+
config.plugins.push(new webpack.HotModuleReplacementPlugin())
22+
config.entry.main.unshift('webpack/hot/dev-server')
23+
const compiler = webpack(config)
24+
server = new WebpackDevServer(compiler, options)
2525

2626
return new Promise((resolve, reject) => {
27-
server.listen(port, "localhost", function(err) {
27+
server.listen(port, 'localhost', function (err) {
2828
if (err) {
29-
reject(err);
29+
reject(err)
3030
}
31-
signale.success(`Webpack Dev Server listening at localhost:${port}`);
32-
signale.watch(`Waiting for webpack to bundle...`);
33-
compiler.hooks.done.tap("done", stats => {
31+
signale.success(`Webpack Dev Server listening at localhost:${port}`)
32+
signale.watch(`Waiting for webpack to bundle...`)
33+
compiler.hooks.done.tap('done', stats => {
3434
if (!stats.hasErrors()) {
35-
signale.success(`Bundle success !`);
36-
resolve();
35+
signale.success(`Bundle success !`)
36+
resolve()
3737
} else {
38-
reject(stats.compilation.errors[0]);
38+
reject(stats.compilation.errors[0])
3939
}
40-
});
41-
});
42-
});
40+
})
41+
})
42+
})
4343
}
4444

45-
function startElectron() {
46-
spawn(electron, ["--hot", "./index.js"], {
47-
stdio: "inherit",
45+
function startElectron () {
46+
spawn(electron, ['--hot', './index.js'], {
47+
stdio: 'inherit',
4848
windowsHide: false
4949
})
50-
.on("close", () => {
51-
server.close();
50+
.on('close', () => {
51+
server.close()
5252
})
53-
.on("error", err => {
54-
signale.error(err);
55-
server.close();
53+
.on('error', err => {
54+
signale.error(err)
55+
server.close()
5656
})
57-
.on("disconnect", () => {
58-
server.close();
57+
.on('disconnect', () => {
58+
server.close()
59+
})
60+
.on('exit', () => {
61+
server.close()
5962
})
60-
.on("exit", () => {
61-
server.close();
62-
});
6363
}
6464

6565
startServer()
6666
.then(() => {
67-
startElectron();
68-
signale.success("Electron started");
67+
startElectron()
68+
signale.success('Electron started')
6969
})
7070
.catch(err => {
71-
signale.error(err);
72-
process.exit(1);
73-
});
71+
signale.error(err)
72+
process.exit(1)
73+
})

0 commit comments

Comments
 (0)