electron/docs/fiddles/native-ui/dialogs/open-file-or-directory/renderer.js
Milan Burda 24c9cbcc0a
docs: handle opening links in the default browser in main.js (#39379)
docs: handle opening links in the default browser in the main process
2023-08-08 12:35:59 +02:00

11 lines
342 B
JavaScript

const { ipcRenderer } = require('electron')
const selectDirBtn = document.getElementById('select-directory')
selectDirBtn.addEventListener('click', event => {
ipcRenderer.send('open-file-dialog')
})
ipcRenderer.on('selected-directory', (event, path) => {
document.getElementById('selected-file').innerHTML = `You selected: ${path}`
})