Stacking of Context Menus in Electron Stacking of Context Menus in Electron node.js node.js

Stacking of Context Menus in Electron


I solve this by first getting the target of the click using e.target. Then, depending on that, I call the corresponding contextmenu. If target hit is not in the list of targets for my app, I use a default contextmenu.

window.addEventListener(    "contextmenu",    e => {        e.preventDefault();        if (e.target.id === 'fullscr'){        console.log(e && e.target);       // e.preventDefault();        mymenu.popup(remote.getCurrentWindow());        }else{            editmenu.popup(remote.getCurrentWindow());        }        console.log(e.which);    },    false);