Open korner-brazers opened 7 years ago
I can reproduce this issue on Linux/Windows with nwjs-sdk-v0.26.0.
I am experiencing this issue
It is simple enough to unregister the hotkey before reloading the page, but as far as I can tell there is no way to unregister the hotkey before the page reloads when the ‘Reload app’ context menu option is clicked which has the effect of breaking hotkeys until the app is actually closed and opened again
I'm experimenting this issue right now. In my case I need to unregister hotkey when window loses focus (I suppose it should be default, but it dont)
Follow my code:
var shortcut = new gui.Shortcut({
key: 'Ctrl+n',
active: function() {
// Some action
},
failed: function(msg) { console.error(msg) }
})
gui.Window.get().on('focus', function() {
gui.App.registerGlobalHotKey(shortcut)
})
gui.Window.get().on('blur', function() {
gui.App.unregisterGlobalHotKey(shortcut)
});
Error message is: Error: Unable to unregister the hotkey
All greetings) encountered such a mistake.
I copy the code from the example
At the first start of the program, everything works fine, but when the program reboots I get here such an error.
The error appears after the restart of the window, to reboot I use the function
window.location.reload()
The event (
active
) does not work any more, but the keys remain registered because for example (Sublime Text) when pressing the (Ctrl+S) does not react until I closenw.exe
NWJS Version : SDK 0.26.0 Operating System : Windows 7