Files
Remote-Control-Center/mc_test/dist/main/preload.js
2025-11-25 09:56:15 +03:00

18 lines
1013 B
JavaScript
Executable File

"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 }),
});