|
@@ -53,6 +53,7 @@ class TouchBar extends EventEmitter {
|
|
|
}
|
|
|
|
|
|
let hasOtherItemsProxy = false
|
|
|
+ const idSet = new Set()
|
|
|
items.forEach((item) => {
|
|
|
if (!(item instanceof TouchBarItem)) {
|
|
|
throw new Error('Each item must be an instance of TouchBarItem')
|
|
@@ -65,6 +66,12 @@ class TouchBar extends EventEmitter {
|
|
|
throw new Error('Must only have one OtherItemsProxy per TouchBar')
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if (!idSet.has(item.id)) {
|
|
|
+ idSet.add(item.id)
|
|
|
+ } else {
|
|
|
+ throw new Error('Cannot add a single instance of TouchBarItem multiple times in a TouchBar')
|
|
|
+ }
|
|
|
})
|
|
|
|
|
|
// register in separate loop after all items are validated
|