mirror of
https://github.com/rubickCenter/rubick
synced 2025-12-29 22:39:45 +08:00
ref: ini
This commit is contained in:
18
src/main/api.js
Normal file
18
src/main/api.js
Normal file
@@ -0,0 +1,18 @@
|
||||
import {app} from 'electron';
|
||||
export default {
|
||||
getPath(arg) {
|
||||
return app.getPath(arg.name);
|
||||
},
|
||||
hideMainWindow(arg, mainWindow) {
|
||||
mainWindow.hide();
|
||||
},
|
||||
showMainWindow(arg, mainWindow) {
|
||||
mainWindow.show();
|
||||
},
|
||||
onPluginEnter(arg) {
|
||||
return arg
|
||||
},
|
||||
setExpendHeight({height}, mainWindow) {
|
||||
mainWindow.setSize(788, height);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import {BrowserWindow, globalShortcut, ipcMain} from 'electron';
|
||||
import {globalShortcut, ipcMain} from 'electron';
|
||||
import Api from './api';
|
||||
|
||||
export default function init(mainWindow) {
|
||||
ipcMain.on('changeWindowSize', (event, arg) => {
|
||||
@@ -12,6 +13,11 @@ export default function init(mainWindow) {
|
||||
globalShortcut.register('Alt+R', () => {
|
||||
mainWindow.show();
|
||||
});
|
||||
|
||||
ipcMain.on('msg-trigger', async (event, arg) => {
|
||||
const data = Api[arg.type](arg, mainWindow);
|
||||
event.sender.send(`msg-back-${arg.type}`, data);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user