Merge pull request #178 from Muril-o/177-fix

fix: #177 [Bug]: Select Folder button for torrent path not working
This commit is contained in:
Cas 2022-05-31 19:15:44 +02:00 committed by GitHub
commit 9f99b4e235
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View file

@ -7,6 +7,9 @@ contextBridge.exposeInMainWorld('IPC', {
},
on: (event, callback) => {
ipcRenderer.on(event, (event, ...args) => callback(...args))
},
off: (event) => {
ipcRenderer.removeAllListeners(event)
}
})
contextBridge.exposeInMainWorld('version', {

View file

@ -16,9 +16,6 @@
}
localStorage.removeItem('relations') // TODO: remove
export let set = JSON.parse(localStorage.getItem('settings')) || { ...defaults }
window.IPC.on('path', data => {
set.torrentPath = data
})
window.addEventListener('paste', ({ clipboardData }) => {
if (clipboardData.items?.[0]) {
if (clipboardData.items[0].type === 'text/plain' && clipboardData.items[0].kind === 'string') {
@ -54,6 +51,11 @@
<script>
import { Tabs, TabLabel, Tab } from '../Tabination.js'
import { onDestroy } from 'svelte'
onDestroy(() => {
window.IPC.off('path')
})
const groups = {
player: {
@ -84,6 +86,9 @@
function handleFolder() {
window.IPC.emit('dialog')
}
window.IPC.on('path', data => {
settings.torrentPath = data
})
</script>
<Tabs>