Initial code commit for project
This commit is contained in:
21
preload.js
Normal file
21
preload.js
Normal file
@@ -0,0 +1,21 @@
|
||||
const { contextBridge, ipcRenderer } = require('electron');
|
||||
|
||||
contextBridge.exposeInMainWorld('electronAPI', {
|
||||
// USB
|
||||
usbListDevices: () => ipcRenderer.invoke('usb:listDevices'),
|
||||
usbConnect: (vendorId, productId) => ipcRenderer.invoke('usb:connect', { vendorId, productId }),
|
||||
|
||||
// Preferences
|
||||
prefsGet: (key) => ipcRenderer.invoke('prefs:get', key),
|
||||
prefsSet: (key, value) => ipcRenderer.invoke('prefs:set', key, value),
|
||||
prefsDelete: (key) => ipcRenderer.invoke('prefs:delete', key),
|
||||
|
||||
// File Picker
|
||||
dialogOpenFile: (options) => ipcRenderer.invoke('dialog:openFile', options),
|
||||
dialogSaveFile: (options) => ipcRenderer.invoke('dialog:saveFile', options),
|
||||
|
||||
// System Info
|
||||
systemCpuTemp: () => ipcRenderer.invoke('system:cpuTemp'),
|
||||
systemRam: () => ipcRenderer.invoke('system:ram'),
|
||||
systemGpu: () => ipcRenderer.invoke('system:gpu'),
|
||||
});
|
||||
Reference in New Issue
Block a user