title: Electron.JS + devtoolsinstaller: 'BrowserWindow.addDevToolsExtension' is deprecated and will be removed. Please use 'session.loadExtension' instead
body: <p>After updating my Electron app from Electron 8.2.5 to 9.0.0, the following errors start to appear in the terminal:</p>
  
  <pre><code>[1] (electron) 'BrowserWindow.addDevToolsExtension' is deprecated and will be removed. Please use 'session.loadExtension' instead.
  [1] Added Extension:  [object Object]
  [1] (electron) 'BrowserWindow.getDevToolsExtensions' is deprecated and will be removed. Please use 'session.getAllExtensions' instead.
  [1] Added Extension:  [object Object]
  </code></pre>
  
  <p>My electron app uses <a href="https://github.com/MarshallOfSound/electron-devtools-installer" rel="noreferrer"><code>electron-devtools-installer</code></a> to install React Developer Tools and Redux DevTools after the Electron app has loaded.</p>
  
  <p>How can we make use of <code>session.loadExtension</code> and <code>session.getAllExtensions</code> to install devtools properly in Electron 9?</p>
  
  <hr>
  
  <pre><code>const electron = require("electron");
  const app = electron.app;
  const path = require("path");
  const isDev = require("electron-is-dev");
  let mainWindow;
  const BrowserWindow = electron.BrowserWindow;
  
  const installExtensions = async () =&gt; {
    const { default: installExtension, REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS } = require('electron-devtools-installer');
  
    const extensions = [REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS];
    for (const extension of extensions) {
      try {
        const name = await installExtension(extension);
        console.log(`Added Extension:  ${name}`);
      } catch (e) {
        console.log('An error occurred: ', err);
      }
    }
  }
  
  ...
  
  app.on("ready", async () =&gt; {
    createWindow();
  
    if (isDev) {
      await installExtensions();
      mainWindow.webContents.on("did-frame-finish-load", () =&gt; {
        mainWindow.webContents.once("devtools-opened", () =&gt; {
          mainWindow.focus();
        });
        mainWindow.webContents.openDevTools({
          mode: 'undocked'
        });
      });
    }
  });
  </code></pre>