dsr/src/preload.ts

23 lines
892 B
TypeScript
Raw Normal View History

2023-07-29 16:23:38 +02:00
import { contextBridge, ipcRenderer } from "electron";
2023-08-04 20:00:31 +02:00
/* Log errors */
ipcRenderer.on("error", (_, err) => {
console.error(err);
});
2023-07-30 00:14:20 +02:00
/* Context bridge */
2023-07-29 19:23:18 +02:00
contextBridge.exposeInMainWorld("internals", {
2023-07-29 20:20:55 +02:00
argv: () => ipcRenderer.invoke("argv"),
2023-07-30 00:14:20 +02:00
allowedExtensions: () => ipcRenderer.invoke("allowedExtensions"),
2023-08-24 15:59:46 +02:00
getFilename: (filepath: string) =>
ipcRenderer.invoke("getFilename", filepath),
askFiles: () => ipcRenderer.invoke("askFiles"),
2023-07-30 01:40:06 +02:00
mergeAudio: (file: string) => ipcRenderer.invoke("mergeAudio", file),
2024-09-18 01:10:28 +02:00
reduceSize: (file: string, bitrate: number, audioTracks: number[]) =>
ipcRenderer.invoke("reduceSize", file, bitrate, audioTracks),
2024-09-19 01:29:17 +02:00
moveMetadata: (file: string, nbTracks: number) =>
ipcRenderer.invoke("moveMetadata", file, nbTracks),
2023-07-30 00:14:20 +02:00
exit: () => ipcRenderer.invoke("exit"),
2023-07-30 02:01:16 +02:00
confirmation: (text: string) => ipcRenderer.invoke("confirmation", text),
});