Little JS tip for opening inspector

Hello! Just wanted to share a little bit of code that might be useful :wink: it permits to open the inspector in a game bundled with electron builder for debugging.

if (typeof require !== "undefined") {
    const electron = require('electron'); 
    if (typeof electron !== "undefined") { 
       electron.remote.getCurrentWindow().webContents.openDevTools()
    }
}
3 Likes

Thank you
Personally i will add also a line for check if electron exist :wink:

1 Like