Add initial touch bar specs

This commit is contained in:
Kevin Sawicki 2017-03-03 10:22:25 -08:00
parent 002369576f
commit c349aeff80
3 changed files with 55 additions and 6 deletions

View file

@ -24,7 +24,7 @@ class TouchBar extends EventEmitter {
super()
if (!Array.isArray(items)) {
throw new Error('The items object provided has to be an array')
throw new Error('Must specify items array as first argument')
}
this.windowListeners = {}
@ -42,7 +42,7 @@ class TouchBar extends EventEmitter {
}
items.forEach((item) => {
if (!(item instanceof TouchBarItem)) {
throw new Error('Each item must be an instance of a TouchBarItem')
throw new Error('Each item must be an instance of TouchBarItem')
}
this.ordereredItems.push(item)
registerItem(item)
@ -121,7 +121,9 @@ TouchBar.TouchBarButton = class TouchBarButton extends TouchBarItem {
this._addLiveProperty('backgroundColor', backgroundColor)
this._addLiveProperty('icon', icon)
if (typeof click === 'function') {
this.onInteraction = config.click
this.onInteraction = () => {
config.click()
}
}
}
}