Documentation update (webPreferences)
This commit is contained in:
parent
8a222be7f7
commit
e5ada44107
1 changed files with 24 additions and 12 deletions
36
README.md
36
README.md
|
@ -18,12 +18,23 @@ $ 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">
|
||||||
<div class="etabs-tabs"></div>
|
<div class="etabs-tabs"></div>
|
||||||
<div class="etabs-buttons"></div>
|
<div class="etabs-buttons"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="etabs-views"></div>
|
<div class="etabs-views"></div>
|
||||||
```
|
```
|
||||||
|
@ -34,14 +45,14 @@ 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();
|
||||||
let tab = tabGroup.addTab({
|
let tab = tabGroup.addTab({
|
||||||
title: "Electron",
|
title: "Electron",
|
||||||
src: "http://electron.atom.io",
|
src: "http://electron.atom.io",
|
||||||
visible: true
|
visible: true
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -238,11 +250,11 @@ const TabGroup = require("electron-tabs");
|
||||||
const dragula = require("dragula");
|
const dragula = require("dragula");
|
||||||
|
|
||||||
var tabGroup = new TabGroup({
|
var tabGroup = new TabGroup({
|
||||||
ready: function (tabGroup) {
|
ready: function (tabGroup) {
|
||||||
dragula([tabGroup.tabContainer], {
|
dragula([tabGroup.tabContainer], {
|
||||||
direction: "horizontal"
|
direction: "horizontal"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue