docs: show the code of adding devtools extension (#16186)

This commit is contained in:
Mosh Feu 2019-01-15 10:48:21 +02:00 committed by Cheng Zhao
parent 0881fd6397
commit 05755ba202

View file

@ -29,7 +29,14 @@ Using the [React Developer Tools][react-devtools] as example:
* on macOS it is `~/Library/Application Support/Google/Chrome/Default/Extensions`.
1. Pass the location of the extension to `BrowserWindow.addDevToolsExtension`
API, for the React Developer Tools, it is something like:
`~/Library/Application Support/Google/Chrome/Default/Extensions/fmkadmapgofadopljbjfkapdkoienihi/0.15.0_0`
```javascript
const path = require('path')
const os = require('os')
BrowserWindow.addDevToolsExtension(
path.join(os.homedir(), '/Library/Application Support/Google/Chrome/Default/Extensions/fmkadmapgofadopljbjfkapdkoienihi/0.15.0_0')
)
```
**Note:** The `BrowserWindow.addDevToolsExtension` API cannot be called before the
ready event of the app module is emitted.