win.requestAttention() is not working > 0.40.x
See original GitHub issueNWJS Version : 43.3-sdk Operating System : up-to-date Windows 10
I have a new error on my app, after upgrading from nw 0.36 to 0.43: Unchecked runtime.lastError: The context from which the function was called did not have an associated app window.
The error is described in the sources (https://github.com/nwjs/nw.js/blob/dc014348efa9bd4d1b9acdf285d50f6ed623203f/src/api/nw_window_api.cc#L126) and it states it should fire when no window is available.
The issue is that I do have a window, it’s described in the manifest, but it’s set to "show": false
to prevent it from flashing.
What I tried:
- downgrading to 40.2 works, error appears at 41.3 and remains after that.
- checking
chrome.runtime.lastError
as soon as I can (it doesn’t get rid of the error, lastError is undefined no matter when I try to check it) - using
"show": true
in the manifest works but it then flashes before the application is ready to be shown, that’s the reason I used to spawn it as “show:false”.
I believe it’s a small bug, that doesn’t prevent anything but is annoying because it will be shown at each startup.
UPDATE
require('nw.gui').Window.get().requestAttention(true)
is the culprit. It triggers the error runtime.lastError
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:11 (2 by maintainers)
Top GitHub Comments
I have
[8316:11952:0908/204143.418:ERROR:nw_window_api.cc(605)] The context from which the function was called did not have an associated app window.
when I dogui.Window.get().setBadgeLabel(‘12’);
NWJS Version : 0.47.3 Operating System : Windows 10 x64
Hi, just to let you know it still is an issue on 0.57.0