Skip to content

Commit

Permalink
Fix: Open Developer Tools (#104)
Browse files Browse the repository at this point in the history
electron "remote" module API is deprecated, thus causing the error when trying to open the developer tools. This PR uses the recommended approach by sending an ipc message to the main process and let it open the devtools
  • Loading branch information
AnonymousWalker authored Dec 7, 2022
1 parent 20ba929 commit 0b38fc7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/js/academybootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ process.stdout.write = console.log.bind(console);
},

showDevTools: function () {
require('electron').remote.getCurrentWindow().toggleDevTools();
this.ipc.send('show-devtools');
},

utils: utils,
Expand Down
2 changes: 1 addition & 1 deletion src/js/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ process.stdout.write = console.log.bind(console);
},

showDevTools: function () {
require('electron').remote.getCurrentWindow().toggleDevTools();
this.ipc.send('show-devtools');
},

utils: utils,
Expand Down
4 changes: 4 additions & 0 deletions src/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ ipcMain.on('theme-loaded', (event, theme) => {
nativeTheme.themeSource = theme.toLowerCase();
});

ipcMain.on('show-devtools', () => {
BrowserWindow.getFocusedWindow().webContents.openDevTools();
});

app.on('ready', function () {
createAppMenus();
createMainSplash();
Expand Down

0 comments on commit 0b38fc7

Please sign in to comment.