diff options
Diffstat (limited to 'example/application/src/utils/reloader.js')
-rw-r--r-- | example/application/src/utils/reloader.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/example/application/src/utils/reloader.js b/example/application/src/utils/reloader.js new file mode 100644 index 0000000..ad78496 --- /dev/null +++ b/example/application/src/utils/reloader.js @@ -0,0 +1,20 @@ +import { app, ipcMain } from 'electron' +import jsonfile from 'jsonfile' +import path from 'path' + +import { mainReloader, rendererReloader } from '../../../../dist' + +const tempDir = path.join(app.getAppPath(), 'temp') +const tempMain = path.join(tempDir, 'main.json') +const tempRend = path.join(tempDir, 'renderer.json') + +mainReloader(tempMain) +rendererReloader(tempRend) + +ipcMain.on('reload:main', async () => { + await jsonfile.writeFile(tempMain, { time: Date.now() }) +}) + +ipcMain.on('reload:renderer', async () => { + await jsonfile.writeFile(tempRend, { time: Date.now() }) +}) |