title: Electron - listen to 'menu-will-show' event
body: <p>Environment:</p>
  
  <ul>
  <li>OS: Ubuntu Cosmic (18.10)</li>
  <li>Electronjs: 4.0.5</li>
  </ul>
  
  <hr>
  
  <p>The Electron docs indicate there are two events on the menu instance:</p>
  
  <ul>
  <li>'menu-will-show'</li>
  <li>'menu-will-close'</li>
  </ul>
  
  <p>The docs do not, however, indicate how to register a listener on the menu instance for an event.</p>
  
  <p>On my main application menu (instantiated with Menu.buildFromTemplate, and
  set with Menu.setApplicationMenu) I have tried variations of the following on the menu instance returned from buildFromTemplate:</p>
  
  <ul>
  <li>menu.addListener('menu-will-show', ()=>{})</li>
  <li>menu.addEventListener('menu-will-show', ()=>{})</li>
  <li>menu.on('menu-will-show', ()=>{})</li>
  <li>(each of the above specifying the class rather than the instance)</li>
  <li>(each of the above specifying the object returned by Menu.getAppliationMenu (in case the menu object I sent is destroyed on <em>set</em>, or otherwise thrown away)</li>
  </ul>
  
  <p>None of them are triggering.</p>
  
  <p>The docs say some events don't work on some operating systems where specified, but there is no additional information on the event documentation suggesting that linux doesn't work.</p>
  
  <p>The intent is to check and set menu item state before the menu is shown.</p>
  
  <p>I can brute force setting the item state another way, but would rather use this mechanism, if possible.</p>
  
  <p>I'll try on Windows and OSX, eventually, but on Linux, it's not happening.</p>