electron/docs/api/touch-bar-scrubber.md
Samuel Attard 81795744cf
fix: ensure the typescript definitions only export correct value types (#28712)
* fix: ensure the typescript definitions only export correct value types

In typescript there are two main types of "types" you can export, value types (class, const) and definition types (type, interface).  The typescript compiler will let anything declared via const or class be used as a value.  Unfortunately we were exporting a bunch of things (see the diff) as class/const when they weren't actually exported values. This lead to typescript being happy but the runtime throwing errors (not something we want).

This change passes "exported-in" context through our docs, to the parser and then to the definitions generator to ensure we only mark things as exported in the ts defs that we actually export.

Fixes #22167

* chore: update typescript-defs

* chore: update typescript-defs

* chore: fix bad typescript in IPC test

* docs: test rendering of new syntax

* chore: update per feedback, use same syntax but with 'this is not exportedd' line
2021-06-15 13:50:31 -07:00

66 lines
3 KiB
Markdown

## Class: TouchBarScrubber
> Create a scrubber (a scrollable selector)
Process: [Main](../glossary.md#main-process)<br />
_This class is not exported from the `'electron'` module. It is only available as a return value of other methods in the Electron API._
### `new TouchBarScrubber(options)`
* `options` Object
* `items` [ScrubberItem[]](structures/scrubber-item.md) - An array of items to place in this scrubber.
* `select` Function (optional) - Called when the user taps an item that was not the last tapped item.
* `selectedIndex` Integer - The index of the item the user selected.
* `highlight` Function (optional) - Called when the user taps any item.
* `highlightedIndex` Integer - The index of the item the user touched.
* `selectedStyle` String (optional) - Selected item style. Can be `background`, `outline` or `none`. Defaults to `none`.
* `overlayStyle` String (optional) - Selected overlay item style. Can be `background`, `outline` or `none`. Defaults to `none`.
* `showArrowButtons` Boolean (optional) - Defaults to `false`.
* `mode` String (optional) - Can be `fixed` or `free`. The default is `free`.
* `continuous` Boolean (optional) - Defaults to `true`.
### Instance Properties
The following properties are available on instances of `TouchBarScrubber`:
#### `touchBarScrubber.items`
A `ScrubberItem[]` array representing the items in this scrubber. Updating this value immediately
updates the control in the touch bar. Updating deep properties inside this array **does not update the touch bar**.
#### `touchBarScrubber.selectedStyle`
A `String` representing the style that selected items in the scrubber should have. Updating this value immediately
updates the control in the touch bar. Possible values:
* `background` - Maps to `[NSScrubberSelectionStyle roundedBackgroundStyle]`.
* `outline` - Maps to `[NSScrubberSelectionStyle outlineOverlayStyle]`.
* `none` - Removes all styles.
#### `touchBarScrubber.overlayStyle`
A `String` representing the style that selected items in the scrubber should have. This style is overlayed on top
of the scrubber item instead of being placed behind it. Updating this value immediately updates the control in the
touch bar. Possible values:
* `background` - Maps to `[NSScrubberSelectionStyle roundedBackgroundStyle]`.
* `outline` - Maps to `[NSScrubberSelectionStyle outlineOverlayStyle]`.
* `none` - Removes all styles.
#### `touchBarScrubber.showArrowButtons`
A `Boolean` representing whether to show the left / right selection arrows in this scrubber. Updating this value
immediately updates the control in the touch bar.
#### `touchBarScrubber.mode`
A `String` representing the mode of this scrubber. Updating this value immediately
updates the control in the touch bar. Possible values:
* `fixed` - Maps to `NSScrubberModeFixed`.
* `free` - Maps to `NSScrubberModeFree`.
#### `touchBarScrubber.continuous`
A `Boolean` representing whether this scrubber is continuous or not. Updating this value immediately
updates the control in the touch bar.