Documentation update (webPreferences)

This commit is contained in:
Thomas Brouard 2020-02-04 12:14:55 +01:00
parent 8a222be7f7
commit e5ada44107

View file

@ -18,7 +18,18 @@ $ npm run demo
## Usage ## Usage
Add the following elements to the app page: Electron-tabs uses webviews, so you first need to use the following `webPreferences` options in the main process:
```js
const mainWindow = new electron.BrowserWindow({
webPreferences: {
nodeIntegration: true,
webviewTag: true
}
});
```
Then add the following elements to the app page:
```html ```html
<div class="etabs-tabgroup"> <div class="etabs-tabgroup">
@ -34,7 +45,7 @@ And call the module in the renderer process:
const TabGroup = require("electron-tabs"); const TabGroup = require("electron-tabs");
``` ```
Then you can initialize a tab group and add tabs to it: Now you can initialize a tab group and add tabs to it:
```javascript ```javascript
let tabGroup = new TabGroup(); let tabGroup = new TabGroup();
@ -52,6 +63,7 @@ If you don't want to write your own styles, you can also insert the sample elect
``` ```
### Note ### Note
Please note, there is a known issue in some versions of Electron that prevents the process to completely shut down and it remains hanging in Background Processes (Windows 10). If you encounter that issue please use the workaround provided at https://github.com/electron/electron/issues/13939 Please note, there is a known issue in some versions of Electron that prevents the process to completely shut down and it remains hanging in Background Processes (Windows 10). If you encounter that issue please use the workaround provided at https://github.com/electron/electron/issues/13939
## API ## API