Implement popOver item type (woo hoo it worked)

This commit is contained in:
Samuel Attard 2016-11-29 18:00:08 +11:00 committed by Kevin Sawicki
parent 2bc45c8665
commit 269d899a99
3 changed files with 115 additions and 44 deletions

View file

@ -7,7 +7,6 @@ class TouchBar {
if (!Array.isArray(items)) {
throw new Error('The items object provided has to be an array')
}
console.log(items)
items.forEach((item) => {
if (!item.id) {
throw new Error('Each item must be an instance of a TouchBarItem')
@ -89,6 +88,20 @@ TouchBar.List = class TouchBarList extends TouchBarItem {
}
}
TouchBar.PopOver = class TouchBarPopOver extends TouchBarItem {
constructor (config) {
super(config)
this.config.type = 'popover'
}
toJSON () {
const config = this.config;
return Object.assign({}, config, {
touchBar: config.touchBar && config.touchBar.toJSON ? config.touchBar.toJSON() : []
})
}
}
TouchBar.Slider = class TouchBarSlider extends TouchBarItem {
constructor (config) {
super(config)