title: Electron does not listen keydown event
body: <p>I am a backend developer who got a little project to fix it.
  So my boss gives me an electron project which runs on touch devices.</p>
  
  <p>I know that I can listen any key events in Javascript if I use the <code>document</code> object, but in electron it does not work, it says the <code>docuemnt cannot be found</code>.</p>
  
  <p>So implemented this when I or other support guy press the F12 button then the dev tools be rendered out in the electron app.</p>
  
  <pre><code>mainWindow = new BrowserWindow({
      'web-preferences': {'web-security': false}
    });
  
    mainWindow.onkeydown = function (e) {
      console.log("Key down");
      if (e.which === 123) {
        console.log("Key is F12");
        mainWindow.webContents.openDevTools();
      }
    };
  </code></pre>
  
  <p>But this code is not working to me. I have no idea how I can listen the F12 button is pressed.</p>
  
  <p>Unfortunately I cannot render out button to the UI which can show the devtools. Because of the customers mustn't press it.</p>
  
  <p>Sometimes I need to see the realtime console tab in devtools on the device.</p>