Search code examples
contextmenuvisiblenw.js

How to check if context menu has been closed?


I've been searching to see if there is a way to check whether the context menu in a nw.js app has been closed(if you click away from the menu or on another window, etc so that the menu disappears). I haven't been able to find an answer.

I have it working when clicking off, but not when clicking outside the window(I've tried adding blur and focusout to the event but those didn't do anything):

contextMenu.popup(e.x, e.y);
$( document ).one( "click ", function() {
     alert(0);
});

Any help figuring out how to solve this would be great.


Solution

  • Alright, figured it out, had to include this;

    var win = gui.Window.get();
    win.on('blur', function() {
        alert(0);
    });