Answers for "electron force reload"

2

electron reload html

const {getCurrentWindow, globalShortcut} = require('electron').remote;

var reload = ()=>{
  getCurrentWindow().reload()
}

globalShortcut.register('F5', reload);
globalShortcut.register('CommandOrControl+R', reload);
// here is the fix bug #3778, if you know alternative ways, please write them
window.addEventListener('beforeunload', ()=>{
  globalShortcut.unregister('F5', reload);
  globalShortcut.unregister('CommandOrControl+R', reload);
})
Posted by: Guest on May-11-2020
0

electron hot reload

/*
To use this code, you need to install the npm package 'electron-reload'
executing this command:
npm install electron-reload
*/

const path = require('path')

require('electron-reload')(__dirname, {
  electron: path.join(__dirname, 'node_modules', '.bin', 'electron'),
  hardResetMethod: 'exit'
});
Posted by: Guest on August-18-2021

Browse Popular Code Answers by Language