10 lines
541 B
JavaScript
10 lines
541 B
JavaScript
|
|
// Preload for the add-on approval overlay (approval.html). Main pushes one
|
||
|
|
// request at a time via `approval-show`; the page answers with the chosen
|
||
|
|
// action id through `approval-pick`. Nothing else is exposed — the overlay
|
||
|
|
// is a pure consent surface.
|
||
|
|
const { contextBridge, ipcRenderer } = require("electron");
|
||
|
|
contextBridge.exposeInMainWorld("approval", {
|
||
|
|
onShow: (cb) => ipcRenderer.on("approval-show", (_e, req) => cb(req)),
|
||
|
|
pick: (reqId, action, checked) => ipcRenderer.invoke("approval-pick", reqId, action, !!checked),
|
||
|
|
});
|