// install
npm i -D electron-reloader
// add this to main.js at top
try { require('electron-reloader')(module);} catch {};
// add this to package.json under `scripts` object
'start': 'electron .'
// now run electron and change file
npm run start
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);
})
/*
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'
});
Code Example |
---|
Javascript :: |
Javascript :: disabled javascript |
Javascript :: jquery check if element has child |
:: Could not find router reducer in state tree, it must be mounted under "router" |
Javascript :: an image gallery is a set of images with corresponding remove buttons |
Javascript :: |
Javascript :: |
:: |
:: |
Javascript :: |
:: |
:: convert string array to objectid mongoose |
:: |
:: spreadjs autofit column with minimum |
Javascript :: |
:: |
:: |
:: |
Javascript :: |
Javascript :: |
Javascript :: iscolor |
:: codewars js Number of People in the Bus |
:: puppeteer inner text |
:: jquery cdn google |
:: regex match number javascript |
:: |
:: |
Javascript :: |
:: eslint no-param-reassign |
:: |