Init
This commit is contained in:
14
electron/preload.cjs
Normal file
14
electron/preload.cjs
Normal file
@@ -0,0 +1,14 @@
|
||||
const { contextBridge, ipcRenderer } = require('electron');
|
||||
|
||||
contextBridge.exposeInMainWorld('electronAPI', {
|
||||
readFile: (filePath) => ipcRenderer.invoke('read-file', filePath),
|
||||
writeFile: (filePath, content) => ipcRenderer.invoke('write-file', filePath, content),
|
||||
openFileDialog: () => ipcRenderer.invoke('open-file-dialog'),
|
||||
saveFileDialog: (defaultPath) => ipcRenderer.invoke('save-file-dialog', defaultPath),
|
||||
openFolderDialog: () => ipcRenderer.invoke('open-folder-dialog'),
|
||||
readDirectory: (dirPath) => ipcRenderer.invoke('read-directory', dirPath),
|
||||
createFile: (filePath) => ipcRenderer.invoke('create-file', filePath),
|
||||
createFolder: (folderPath) => ipcRenderer.invoke('create-folder', folderPath),
|
||||
deleteFile: (filePath) => ipcRenderer.invoke('delete-file', filePath),
|
||||
renameFile: (oldPath, newPath) => ipcRenderer.invoke('rename-file', oldPath, newPath)
|
||||
});
|
||||
Reference in New Issue
Block a user