From b055aad397c82c595d98c9fdafd3a06228f78349 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sat, 29 Jul 2023 20:20:55 +0200 Subject: [PATCH] get argv --- src/main.ts | 1 + src/preload.ts | 1 + src/scripts/renderer.ts | 8 +++++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index a89e82f..cb04677 100644 --- a/src/main.ts +++ b/src/main.ts @@ -17,6 +17,7 @@ const createWindow = () => { app.whenReady().then(() => { ipcMain.handle("ffmpeg", () => ffmpegPath); + ipcMain.handle("argv", () => process.argv); createWindow(); diff --git a/src/preload.ts b/src/preload.ts index b97ee56..7c19264 100644 --- a/src/preload.ts +++ b/src/preload.ts @@ -2,4 +2,5 @@ import { contextBridge, ipcRenderer } from "electron"; contextBridge.exposeInMainWorld("internals", { ffmpeg: () => ipcRenderer.invoke("ffmpeg"), + argv: () => ipcRenderer.invoke("argv"), }); diff --git a/src/scripts/renderer.ts b/src/scripts/renderer.ts index 388809e..5595e91 100644 --- a/src/scripts/renderer.ts +++ b/src/scripts/renderer.ts @@ -1,11 +1,17 @@ /* Context bridge */ let internals: { ffmpeg: () => Promise; + argv: () => Promise; }; const get_ffmpeg = async () => { const response = await internals.ffmpeg(); console.log(response); }; - get_ffmpeg(); + +const get_argv = async () => { + const response = await internals.argv(); + console.log(response); +}; +get_argv();