init
This commit is contained in:
17
mc_test/dist/main/preload.js
vendored
Executable file
17
mc_test/dist/main/preload.js
vendored
Executable file
@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const { contextBridge, ipcRenderer } = require('electron');
|
||||
// Expose protected methods that allow the renderer process to use
|
||||
// the ipcRenderer without exposing the entire object
|
||||
contextBridge.exposeInMainWorld('electronAPI', {
|
||||
// Подключение к машине
|
||||
connectToMachine: (machine) => ipcRenderer.invoke('connect-to-machine', machine),
|
||||
// Управление состоянием машины
|
||||
controlMachine: (machineId, action) => ipcRenderer.invoke('control-machine', { machineId, action }),
|
||||
// Получение статуса машины
|
||||
getMachineStatus: (machineId) => ipcRenderer.invoke('get-machine-status', machineId),
|
||||
// Получение списка машин
|
||||
getMachineList: () => ipcRenderer.invoke('get-machine-list'),
|
||||
// Логирование
|
||||
logEvent: (level, tag, message, context) => ipcRenderer.send('log-event', { level, tag, message, context }),
|
||||
});
|
||||
Reference in New Issue
Block a user