feishin/src/main/preload/browser.ts
Kendall Garner 9995b2e774
[enhancement]: support clearing query and http cache (#475)
* [enhancement]: support clearing query and http cache

  - Adds the ability to invalidate all queries (useful for forcing refresh, and clearing lyrics which are cached forever)
  - [Desktop only] adds the ability to clear the Electron HTTP cache (e.g. cached images)

* use clearer language

* move cache settings to general
2024-01-31 06:27:56 +00:00

41 lines
711 B
TypeScript

import { ipcRenderer } from 'electron';
const exit = () => {
ipcRenderer.send('window-close');
};
const maximize = () => {
ipcRenderer.send('window-maximize');
};
const minimize = () => {
ipcRenderer.send('window-minimize');
};
const unmaximize = () => {
ipcRenderer.send('window-unmaximize');
};
const quit = () => {
ipcRenderer.send('window-quit');
};
const devtools = () => {
ipcRenderer.send('window-dev-tools');
};
const clearCache = (): Promise<void> => {
return ipcRenderer.invoke('window-clear-cache');
};
export const browser = {
clearCache,
devtools,
exit,
maximize,
minimize,
quit,
unmaximize,
};
export type Browser = typeof browser;