aboutsummaryrefslogtreecommitdiff
path: root/example/application/src/utils/get-json.js
blob: 18f4403220fce77aa2f2f68bb4bbb13ae2d16b22 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
import { app, ipcMain } from 'electron'
import jsonfile from 'jsonfile'
import path from 'path'

ipcMain.on('get:json', async (event) => {
  const tempDir = path.join(app.getAppPath(), 'temp')

  const main = await jsonfile.readFile(path.join(tempDir, 'main.json'))
  const renderer = await jsonfile.readFile(path.join(tempDir, 'renderer.json'))

  event.sender.send('get:json:result', { main, renderer })
})