// Preload for the page-dialog overlay (js-dialog.html): the Theseus-drawn // replacement for a page's alert / confirm / prompt. Main pushes one request // at a time via `jsdialog-show`; the page answers with `jsdialog-answer`. const { contextBridge, ipcRenderer } = require("electron"); contextBridge.exposeInMainWorld("jsdialog", { onShow: (cb) => ipcRenderer.on("jsdialog-show", (_e, req) => cb(req)), // value: a string for prompt(); { response, checkboxChecked } for one of Theseus's own prompts. answer: (reqId, ok, value) => ipcRenderer.invoke("jsdialog-answer", reqId, !!ok, value == null ? null : (typeof value === "object" ? value : String(value))), });