feat(desktop): optional wipe-on-close (Settings -> Sicherheit)
This commit is contained in:
@@ -159,6 +159,24 @@ const api = {
|
||||
// Window fullscreen ------------------------------------------------------
|
||||
setFullscreen: (enabled: boolean): Promise<void> =>
|
||||
ipcRenderer.invoke(CHANNELS.WINDOW_SET_FULLSCREEN, enabled),
|
||||
|
||||
// Wipe-on-close ----------------------------------------------------------
|
||||
// Subscribe to the main-process pre-quit notification. The renderer's
|
||||
// callback does the actual wipe (memoryWipe.ts) and resolves; we ack
|
||||
// unconditionally so main can finish quitting — better to lose the wipe
|
||||
// than to hang the app shutdown if the callback throws.
|
||||
onWipeBeforeQuit: (cb: () => Promise<void>): Unsubscribe => {
|
||||
const handler = async (_evt: Electron.IpcRendererEvent): Promise<void> => {
|
||||
try {
|
||||
await cb();
|
||||
} catch (err) {
|
||||
console.warn('[wipe] renderer cb failed', err);
|
||||
}
|
||||
ipcRenderer.send(CHANNELS.APP_WIPE_BEFORE_QUIT + ':done');
|
||||
};
|
||||
ipcRenderer.on(CHANNELS.APP_WIPE_BEFORE_QUIT, handler);
|
||||
return () => ipcRenderer.removeListener(CHANNELS.APP_WIPE_BEFORE_QUIT, handler);
|
||||
},
|
||||
} as const;
|
||||
|
||||
export type ElectronAPI = typeof api;
|
||||
|
||||
Reference in New Issue
Block a user