-
Notifications
You must be signed in to change notification settings - Fork 0
/
preload.js
25 lines (19 loc) · 1022 Bytes
/
preload.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
const { contextBridge, ipcRenderer } = require('electron')
contextBridge.exposeInMainWorld('electronAPI', {
runTurron: (message) => ipcRenderer.send('run-turron', message),
runTurronAudio: (message) => ipcRenderer.send('run-turron-audio', message),
setSources: (sources) => ipcRenderer.send('set-turron-sources', sources),
getSources: () => ipcRenderer.send('get-turron-sources'),
openDownloads: (sources) => ipcRenderer.send('open-turron-downloads', sources),
send: ( channel, data ) => ipcRenderer.invoke( channel, data ),
handle: ( channel, callable, event, data ) => ipcRenderer.on( channel, callable( event, data ) )
})
// window.addEventListener('DOMContentLoaded', () => {
// const replaceText = (selector, text) => {
// const element = document.getElementById(selector)
// if (element) element.innerText = text
// }
// for (const dependency of ['chrome', 'node', 'electron']) {
// replaceText(`${dependency}-version`, process.versions[dependency])
// }
// })