electron/docs/fiddles/native-ui/dialogs/open-file-or-directory/preload.js

5 lines
184 B
JavaScript

const { contextBridge, ipcRenderer } = require('electron/renderer')
contextBridge.exposeInMainWorld('electronAPI', {
openFileDialog: () => ipcRenderer.invoke('open-file-dialog')
})