mirror of
https://github.com/electron/electron.git
synced 2026-05-02 03:00:22 -04:00
Support setting the initial/available colors
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
const {EventEmitter} = require('events')
|
||||
|
||||
let itemIdIncrementor = 1
|
||||
let nextItemID = 1
|
||||
|
||||
class TouchBar extends EventEmitter {
|
||||
|
||||
@@ -94,7 +94,7 @@ class TouchBar extends EventEmitter {
|
||||
class TouchBarItem extends EventEmitter {
|
||||
constructor (config) {
|
||||
super()
|
||||
this.id = `${itemIdIncrementor++}`
|
||||
this.id = `${nextItemID++}`
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,6 +113,8 @@ TouchBar.ColorPicker = class TouchBarColorPicker extends TouchBarItem {
|
||||
constructor (config) {
|
||||
super(config)
|
||||
this.type = 'colorpicker'
|
||||
this.availableColors = config.availableColors
|
||||
this.selectedColor = config.selectedColor
|
||||
|
||||
const {change} = config
|
||||
if (typeof change === 'function') {
|
||||
@@ -151,7 +153,7 @@ TouchBar.Label = class TouchBarLabel extends TouchBarItem {
|
||||
}
|
||||
}
|
||||
|
||||
TouchBar.PopOver = class TouchBarPopOver extends TouchBarItem {
|
||||
TouchBar.Popover = class TouchBarPopover extends TouchBarItem {
|
||||
constructor (config) {
|
||||
super(config)
|
||||
this.type = 'popover'
|
||||
|
||||
Reference in New Issue
Block a user