first commit
This commit is contained in:
16
electron/preload.js
Normal file
16
electron/preload.js
Normal file
@@ -0,0 +1,16 @@
|
||||
const { contextBridge, ipcRenderer } = require('electron')
|
||||
|
||||
contextBridge.exposeInMainWorld('tunjiAPI', {
|
||||
workspace: {
|
||||
select: () => ipcRenderer.invoke('workspace:select'),
|
||||
get: () => ipcRenderer.invoke('workspace:get'),
|
||||
set: (path) => ipcRenderer.invoke('workspace:set', path),
|
||||
ensureStructure: (path) => ipcRenderer.invoke('workspace:ensure-structure', path),
|
||||
},
|
||||
file: {
|
||||
read: (filePath) => ipcRenderer.invoke('file:read', filePath),
|
||||
write: (filePath, content) => ipcRenderer.invoke('file:write', filePath, content),
|
||||
list: (dirPath) => ipcRenderer.invoke('file:list', dirPath),
|
||||
mkdir: (dirPath) => ipcRenderer.invoke('file:mkdir', dirPath),
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user