hot-reload: implememnt auto session/state backup on reload and display error stack in a popup
This commit is contained in:
parent
6f6e1396e4
commit
537dd44795
5 changed files with 109 additions and 52 deletions
|
|
@ -10,7 +10,8 @@ var path = require('path'),
|
|||
|
||||
var openedSessions = {},
|
||||
widgetHashTable = {},
|
||||
lastSavingClient
|
||||
lastSavingClient,
|
||||
sessionBackups = {}
|
||||
|
||||
module.exports = {
|
||||
|
||||
|
|
@ -21,6 +22,12 @@ module.exports = {
|
|||
ipc.send('readOnly')
|
||||
}
|
||||
|
||||
if (data.backupId && sessionBackups[data.backupId]) {
|
||||
ipc.send('loadBackup', sessionBackups[data.backupId])
|
||||
delete sessionBackups[data.backupId]
|
||||
return
|
||||
}
|
||||
|
||||
if (settings.read('newSession')) {
|
||||
ipc.send('sessionNew')
|
||||
return
|
||||
|
|
@ -295,11 +302,17 @@ module.exports = {
|
|||
fullscreen: function(data) {
|
||||
window.setFullScreen(!window.isFullScreen())
|
||||
},
|
||||
|
||||
refresh: function(data) {
|
||||
for (var w of BrowserWindow.getAllWindows()){
|
||||
w.reload()
|
||||
}
|
||||
|
||||
reload: function(data) {
|
||||
|
||||
ipc.send('reload')
|
||||
|
||||
},
|
||||
|
||||
storeBackup: function(data) {
|
||||
|
||||
sessionBackups[data.backupId] = data
|
||||
|
||||
},
|
||||
|
||||
reloadCss:function(){
|
||||
|
|
@ -317,5 +330,10 @@ module.exports = {
|
|||
|
||||
errorLog: function(data) {
|
||||
console.error(data)
|
||||
},
|
||||
|
||||
errorPopup: function(data) {
|
||||
ipc.send('error', data)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ module.exports = function(options={}) {
|
|||
}
|
||||
})
|
||||
|
||||
window.webContents.on('will-navigate', (event)=>event.preventDefault())
|
||||
// window.webContents.on('will-navigate', (event)=>event.preventDefault())
|
||||
window.webContents.on('new-window', (event)=>event.preventDefault())
|
||||
|
||||
if (options.fullscreen) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue