How to include Chrome DevTools in Electron?

前端 未结 7 1216
小鲜肉
小鲜肉 2020-12-09 04:52

I\'m still new to Electron which I\'m currently following here.

I\'ve read this page regarding on how to include the Chrome DevTools so that I can debug my applicati

相关标签:
7条回答
  • 2020-12-09 05:28

    you can open dev tool like this:

    mainWindow = new BrowserWindow({ width: 1024, height: 768 });
    mainWindow.loadURL('your url');
    mainWindow.webContents.openDevTools();
    mainWindow.webContents.on('devtools-opened', () => {
        setImmediate(() => {
            // do whatever you want to do after dev tool completely opened here
            mainWindow.focus();
        });
    });
    
    0 讨论(0)
提交回复
热议问题