preload.cjs 688 B

123456789101112
  1. const { contextBridge, ipcRenderer } = require('electron');
  2. contextBridge.exposeInMainWorld('electronAPI', {
  3. scanADBDevices: () => ipcRenderer.invoke('scan-adb-devices'),
  4. getADBDevices: () => ipcRenderer.invoke('get-adb-devices'),
  5. connectADBDevice: (ipPort) => ipcRenderer.invoke('connect-adb-device', ipPort),
  6. getDeviceResolution: (ipPort) => ipcRenderer.invoke('get-device-resolution', ipPort),
  7. captureScreenshot: (ipPort) => ipcRenderer.invoke('capture-screenshot', ipPort),
  8. sendTap: (ipPort, x, y) => ipcRenderer.invoke('send-tap', ipPort, x, y),
  9. sendSwipe: (ipPort, x1, y1, x2, y2, duration) => ipcRenderer.invoke('send-swipe', ipPort, x1, y1, x2, y2, duration),
  10. });