♻️ 代码重构

This commit is contained in:
muwoo
2021-12-06 18:23:34 +08:00
parent cd41f0561c
commit 1353c440aa
29 changed files with 295 additions and 13562 deletions

View File

@@ -1,12 +1,9 @@
import { BrowserWindow, ipcMain } from "electron";
import { BrowserWindow, ipcMain, dialog } from "electron";
import { runner } from "../browsers";
const runnerInstance = runner();
const API: any = {
setExpendHeight({ height }: { height: number }, win: BrowserWindow): void {
win.setSize(800, height || 60);
},
openPlugin({ plugin }, window) {
runnerInstance.removeView(window);
runnerInstance.init(plugin, window);
@@ -14,6 +11,22 @@ const API: any = {
removePlugin(e, window) {
runnerInstance.removeView(window);
},
hideMainWindow(arg, window) {
window.hide();
},
showMainWindow(arg, window) {
window.show();
},
showOpenDialog({ data }, window) {
dialog.showOpenDialogSync(window, data);
},
setExpendHeight({ data: height }, window: BrowserWindow) {
const targetHeight = height;
window.setSize(window.getSize()[0], targetHeight);
},
setSubInput() {
},
};
export default (mainWindow: BrowserWindow) => {