feishin/src/main/preload/browser.ts

42 lines
711 B
TypeScript
Raw Normal View History

2022-12-19 15:59:14 -08:00
import { ipcRenderer } from 'electron';
const exit = () => {
2023-07-01 19:10:05 -07:00
ipcRenderer.send('window-close');
2022-12-19 15:59:14 -08:00
};
2023-09-27 02:37:03 -07:00
2022-12-19 15:59:14 -08:00
const maximize = () => {
2023-07-01 19:10:05 -07:00
ipcRenderer.send('window-maximize');
2022-12-19 15:59:14 -08:00
};
2023-09-27 02:37:03 -07:00
2022-12-19 15:59:14 -08:00
const minimize = () => {
2023-07-01 19:10:05 -07:00
ipcRenderer.send('window-minimize');
2022-12-19 15:59:14 -08:00
};
2023-09-27 02:37:03 -07:00
2022-12-19 15:59:14 -08:00
const unmaximize = () => {
2023-07-01 19:10:05 -07:00
ipcRenderer.send('window-unmaximize');
2022-12-19 15:59:14 -08:00
};
2023-09-27 02:37:03 -07:00
const quit = () => {
ipcRenderer.send('window-quit');
};
2023-02-08 14:42:13 -08:00
const devtools = () => {
2023-07-01 19:10:05 -07:00
ipcRenderer.send('window-dev-tools');
2023-02-08 14:42:13 -08:00
};
const clearCache = (): Promise<void> => {
return ipcRenderer.invoke('window-clear-cache');
};
2022-12-19 15:59:14 -08:00
export const browser = {
clearCache,
2023-07-01 19:10:05 -07:00
devtools,
exit,
maximize,
minimize,
2023-09-27 02:37:03 -07:00
quit,
2023-07-01 19:10:05 -07:00
unmaximize,
2022-12-19 15:59:14 -08:00
};
export type Browser = typeof browser;