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

@ -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)
}
}
}