-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreload.js
More file actions
30 lines (26 loc) 路 936 Bytes
/
Copy pathpreload.js
File metadata and controls
30 lines (26 loc) 路 936 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const { contextBridge, ipcRenderer } = require('electron');
/**
* Preload script - Secure bridge between renderer and main process
* Exposes safe APIs to the renderer process via contextBridge
*/
contextBridge.exposeInMainWorld('electronAPI', {
/**
* Upload/parse an SRT file
* @param {Object} fileData - Optional { content: string, filename: string }
*/
uploadFile: (fileData) => ipcRenderer.invoke('upload-file', fileData),
/**
* Shift subtitle timings
* @param {Object} data - { cues, offsetMs, mode, startTime?, endTime? }
*/
shiftSubtitles: (data) => ipcRenderer.invoke('shift-subtitles', data),
/**
* Save shifted subtitles to file (triggers native save dialog)
* @param {Object} data - { cues, filename }
*/
downloadFile: (data) => ipcRenderer.invoke('download-file', data),
/**
* Check if running in Electron
*/
isElectron: true,
});