From bff3fffcbdb043b6de76f8d095cb2f2556b0f226 Mon Sep 17 00:00:00 2001
From: DYH1319 <1245687900@qq.com>
Date: Sat, 24 Jan 2026 23:18:16 +0800
Subject: [PATCH] feat: Add the Handle, HandleOnce, and RemoveHandler events to
IpcMain
---
src/ElectronNET.API/API/IpcMain.cs | 43 +++++++++++++++++++++++++++++
src/ElectronNET.Host/api/ipc.js | 25 +++++++++++++++++
src/ElectronNET.Host/api/ipc.js.map | 2 +-
src/ElectronNET.Host/api/ipc.ts | 28 +++++++++++++++++++
4 files changed, 97 insertions(+), 1 deletion(-)
diff --git a/src/ElectronNET.API/API/IpcMain.cs b/src/ElectronNET.API/API/IpcMain.cs
index 0260a88..62961cd 100644
--- a/src/ElectronNET.API/API/IpcMain.cs
+++ b/src/ElectronNET.API/API/IpcMain.cs
@@ -154,5 +154,48 @@ namespace ElectronNET.API
{
BridgeConnector.Socket.Emit("sendToIpcRendererBrowserView", browserView.Id, channel, data);
}
+
+ ///
+ /// Adds a handler for an invokeable IPC. This handler will be called
+ /// whenever a renderer calls ipcRenderer.invoke(channel, ...args).
+ ///
+ /// Channelname.
+ /// Callback Method.
+ public void Handle(string channel, Func