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

6 lines
258 B
JavaScript

const selectDirBtn = document.getElementById('select-directory')
selectDirBtn.addEventListener('click', async () => {
const path = await window.electronAPI.openFileDialog()
document.getElementById('selected-file').innerHTML = `You selected: ${path}`
})