Drop on prefix from property names

This commit is contained in:
Kevin Sawicki 2017-03-14 14:02:48 -07:00
parent 6175ee05e2
commit 2e0e4e69bb
2 changed files with 14 additions and 14 deletions

View file

@ -1,16 +1,16 @@
## Class: TouchBarScrubber
> Create a scrubber (a scrollablbe selector)
> Create a scrubber (a scrollable selector)
Process: [Main](../tutorial/quick-start.md#main-process)
### `new TouchBarScrubber(options)`
* `options` Object
* `items` [ScrubberItem[]](structures/scrubber-item.md) - An array of items to place in this scruber
* `onSelect` Function - Called when the user taps an item that was not the last tapped item
* `items` [ScrubberItem[]](structures/scrubber-item.md) - An array of items to place in this scrubber
* `select` Function - Called when the user taps an item that was not the last tapped item
* `selectedIndex` - The index of the item the user selected
* `onHightlight` Function - Called when the user taps any item
* `highlight` Function - Called when the user taps any item
* `highlightedIndex` - The index of the item the user touched
### Instance Properties
@ -33,7 +33,7 @@ updates the control in the touch bar. Possible values:
#### `touchBarSegmentedControl.overlayStyle`
A `String` retpresenting the style that selected items in the scrubber should have. This style is overlayed on top
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:
@ -56,5 +56,5 @@ updates the control in the touch bar. Possible values:
#### `touchBarSegmentedControl.continuous`
A `Boolean` representing whether this scrubber is continous or not. Updating this value immediately
updates the control in the touch bar.
A `Boolean` representing whether this scrubber is continuous or not. Updating this value immediately
updates the control in the touch bar.

View file

@ -235,8 +235,8 @@ TouchBar.TouchBarScrubber = class TouchBarScrubber extends TouchBarItem {
constructor (config) {
super()
if (config == null) config = {}
const {items} = config
let {onSelect, onHighlight, selectedStyle, highlightedStyle, showArrowButtons, continuous, mode} = config
const {items, selectedStyle, highlightedStyle, showArrowButtons, continuous, mode} = config
let {select, highlight} = config
this.type = 'scrubber'
this._addLiveProperty('items', items)
this._addLiveProperty('selectedStyle', selectedStyle || null)
@ -245,14 +245,14 @@ TouchBar.TouchBarScrubber = class TouchBarScrubber extends TouchBarItem {
this._addLiveProperty('mode', mode || 'free')
this._addLiveProperty('continuous', continuous || true)
if (typeof onSelect === 'function' || typeof onHighlight === 'function') {
if (onSelect == null) onSelect = () => {}
if (onHighlight == null) onHighlight = () => {}
if (typeof select === 'function' || typeof highlight === 'function') {
if (select == null) select = () => {}
if (highlight == null) highlight = () => {}
this.onInteraction = (details) => {
if (details.type === 'select') {
onSelect(details.selectedIndex)
select(details.selectedIndex)
} else if (details.type === 'highlight') {
onHighlight(details.highlightedIndex)
highlight(details.highlightedIndex)
}
}
}