Some docs for touch bar
This commit is contained in:
parent
15dcc314d3
commit
61949657f0
2 changed files with 50 additions and 0 deletions
|
@ -1266,6 +1266,12 @@ Controls whether to hide cursor when typing.
|
||||||
Adds a vibrancy effect to the browser window. Passing `null` or an empty string
|
Adds a vibrancy effect to the browser window. Passing `null` or an empty string
|
||||||
will remove the vibrancy effect on the window.
|
will remove the vibrancy effect on the window.
|
||||||
|
|
||||||
|
#### `win.setTouchBar(touchBar)` _macOS_
|
||||||
|
|
||||||
|
* `touchBar` TouchBar
|
||||||
|
|
||||||
|
Sets the touchBar layout for the current window.
|
||||||
|
|
||||||
[blink-feature-string]: https://cs.chromium.org/chromium/src/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5?l=62
|
[blink-feature-string]: https://cs.chromium.org/chromium/src/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5?l=62
|
||||||
[quick-look]: https://en.wikipedia.org/wiki/Quick_Look
|
[quick-look]: https://en.wikipedia.org/wiki/Quick_Look
|
||||||
[vibrancy-docs]: https://developer.apple.com/reference/appkit/nsvisualeffectview?language=objc
|
[vibrancy-docs]: https://developer.apple.com/reference/appkit/nsvisualeffectview?language=objc
|
||||||
|
|
44
docs/api/touch-bar.md
Normal file
44
docs/api/touch-bar.md
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
## Class: TouchBar
|
||||||
|
|
||||||
|
> Create TouchBar layouts for native macOS applications
|
||||||
|
|
||||||
|
Process: [Main](../tutorial/quick-start.md#main-process)
|
||||||
|
|
||||||
|
### `new TouchBar(items)`
|
||||||
|
|
||||||
|
* `items` (TouchBarButton | TouchBarColorPicker | TouchBarGroup | TouchBarLabel | TouchBarPopOver | TouchBarSlider)[]
|
||||||
|
|
||||||
|
Creates a new touch bar. Note any changes to the TouchBar instance
|
||||||
|
will not affect the rendered TouchBar. To affect the rendered
|
||||||
|
TouchBar you **must** use either methods on the TouchBar or methods
|
||||||
|
on the TouchBar* items
|
||||||
|
|
||||||
|
### Instance Methods
|
||||||
|
|
||||||
|
The `menu` object has the following instance methods:
|
||||||
|
|
||||||
|
#### `touchBar.destroy()`
|
||||||
|
|
||||||
|
Immediately destroys the TouchBar instance and will reset the rendered
|
||||||
|
touch bar.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
The `TouchBar` class is only available in the main process, it is not currently possible to use in the renderer process **even** through the remote module.
|
||||||
|
|
||||||
|
### Main process
|
||||||
|
|
||||||
|
An example of creating a touch bar in the main process:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const {TouchBar, TouchBarButton} = require('electron')
|
||||||
|
|
||||||
|
const touchBar = new TouchBar([
|
||||||
|
new TouchBarButton({
|
||||||
|
label: 'Example Button',
|
||||||
|
click: () => console.log('I was clicked')
|
||||||
|
})
|
||||||
|
])
|
||||||
|
|
||||||
|
mainWindow.setTouchBar(touchBar)
|
||||||
|
```
|
Loading…
Add table
Add a link
Reference in a new issue