mirror of
https://github.com/koodo-reader/koodo-reader.git
synced 2026-10-07 05:11:52 -04:00
11 lines
370 B
JavaScript
11 lines
370 B
JavaScript
const { contextBridge, ipcRenderer } = require("electron");
|
|
|
|
contextBridge.exposeInMainWorld("chatAPI", {
|
|
send: (type, payload) => ipcRenderer.send("chat-message", { type, payload }),
|
|
on: (cb) => {
|
|
const handler = (_event, data) => cb(data);
|
|
ipcRenderer.on("chat-reply", handler);
|
|
return () => ipcRenderer.removeListener("chat-reply", handler);
|
|
},
|
|
});
|