win.requestAttention() doesn't work in NW.js 0.50.x
NWJS Version : reproduces in both 0.50.0 and 0.50.3 Operating System : Windows 10 64-bit
Expected behavior
The window 'requestAttention' method should work.
Actual behavior
It doesn't seem to work in 0.50.x. It logs a console error: Unchecked runtime.lastError: The context from which the function was called did not have an associated app window.
How to reproduce
Minimal repro: win-requestattention.zip
Click the button. It just runs: nw.Window.get().requestAttention(3);
I am also seeing this behavior with NW.js 0.58.0. This fails in all of the following scenarios:
nw.Window.open('page.html', (newWindow) => {
newWindow.requestAttention(true);
});
nw.Window.get().requestAttention(true);
nw.Window.get().requestAttention(false);
nw.Window.get().requestAttention(3);
These all fail with the same error @AshleyScirra mentioned:
Unchecked runtime.lastError: The context from which the function was called did not have an associated app window.
@rogerwang I hate to ping you but this sure looks like it'd be an easy fix and has been open for almost a year. Any input?
@rogerwang This is still broken with 0.62.0.
seem i got the same error on 0.82.0
The problem still exists in 0.85.0
An alternative solution:
const win = nw.Window.get();
chrome.windows.update(win.cWindow.id, { drawAttention: true });