0

How can I toggle devTool in electron app after packaging. I developed this app in angular2. So, I just want to have a button which will toggle devTool on demand.

Thank you!

Neitsa
  • 7,693
  • 1
  • 28
  • 45
Narottam Goyal
  • 3,534
  • 27
  • 26

1 Answers1

4

Based on the Electron API documentation, this should do the trick:

let win = new BrowserWindow()
win.webContents.openDevTools()

If you want to connect the openDevTools function to a button click or keyboard shortcut, you'll have to wire it to your renderer process via IPC.

Jens Habegger
  • 5,266
  • 41
  • 57
  • Above two lines are for JavaScript and I want to add the same in typescript. Any idea...? – Narottam Goyal Dec 05 '16 at 08:23
  • 1
    TypeScript is (mostly) a superset of JavaScript, which means that with very few exceptions all JS is valid TS. The above code will work fine in your Typescript files. – Jens Habegger Dec 05 '16 at 09:13