fix: remove xo, migration to eslint

This commit is contained in:
JellyBrick
2023-08-29 17:22:38 +09:00
parent 31a7588cee
commit c722896a73
142 changed files with 17210 additions and 18409 deletions

View File

@ -1,34 +1,35 @@
const path = require("path");
const path = require('node:path');
const { app, BrowserWindow, ipcMain, ipcRenderer } = require("electron");
const config = require("../config");
const { app, BrowserWindow, ipcMain, ipcRenderer } = require('electron');
const config = require('../config');
module.exports.restart = () => {
process.type === 'browser' ? restart() : ipcRenderer.send('restart');
};
module.exports.setupAppControls = () => {
ipcMain.on('restart', restart);
ipcMain.handle('getDownloadsFolder', () => app.getPath("downloads"));
ipcMain.on('reload', () => BrowserWindow.getFocusedWindow().webContents.loadURL(config.get("url")));
ipcMain.handle('getPath', (_, ...args) => path.join(...args));
}
ipcMain.on('restart', restart);
ipcMain.handle('getDownloadsFolder', () => app.getPath('downloads'));
ipcMain.on('reload', () => BrowserWindow.getFocusedWindow().webContents.loadURL(config.get('url')));
ipcMain.handle('getPath', (_, ...args) => path.join(...args));
};
function restart() {
app.relaunch({ execPath: process.env.PORTABLE_EXECUTABLE_FILE });
// execPath will be undefined if not running portable app, resulting in default behavior
app.quit();
app.relaunch({ execPath: process.env.PORTABLE_EXECUTABLE_FILE });
// ExecPath will be undefined if not running portable app, resulting in default behavior
app.quit();
}
function sendToFront(channel, ...args) {
BrowserWindow.getAllWindows().forEach(win => {
win.webContents.send(channel, ...args);
});
for (const win of BrowserWindow.getAllWindows()) {
win.webContents.send(channel, ...args);
}
}
module.exports.sendToFront =
process.type === 'browser'
? sendToFront
: () => {
console.error('sendToFront called from renderer');
};
module.exports.sendToFront
= process.type === 'browser'
? sendToFront
: () => {
console.error('sendToFront called from renderer');
};