summaryrefslogtreecommitdiffstats
path: root/ui/preload.js
blob: 108bffe42a32c321ffd5a9aa24eaf24322d853fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
const { contextBridge, ipcRenderer } = require('electron');

contextBridge.exposeInMainWorld('electronAPI', {
    loadConfig: () => ipcRenderer.invoke('load-config'),
    saveConfig: (config) => ipcRenderer.invoke('save-config', config),
    restartApp: () => ipcRenderer.invoke('restart-app'),
    getMicrophones: () => ipcRenderer.invoke('get-microphones'),
    installRequirements: () => ipcRenderer.invoke('install-requirements'),
    onPythonOutput: (callback) => ipcRenderer.on('python-output', (event, data) => callback(data))
});

console.log('Preload script loaded.');