Electron_generator/preload.js

8 lines
395 B
JavaScript

const { contextBridge, ipcRenderer } = require('electron');
// CRITICAL: This exposes a secure API to the renderer process under window.electronAPI
contextBridge.exposeInMainWorld('electronAPI', {
// The function we will call from renderer.js.
// It sends the data over the 'form:submit' channel and waits for a response.
submitForm: (data) => ipcRenderer.invoke('form:submit', data)
});