Return early when touchBar is null
This commit is contained in:
parent
69638a399c
commit
eff49ad19c
1 changed files with 8 additions and 5 deletions
|
@ -205,13 +205,16 @@ Object.assign(BrowserWindow.prototype, {
|
|||
|
||||
// TouchBar API
|
||||
BrowserWindow.prototype.setTouchBar = function (touchBar) {
|
||||
if (touchBar === null || typeof touchBar === 'undefined') {
|
||||
if (touchBar == null) {
|
||||
this._destroyTouchBar()
|
||||
} else if (Array.isArray(touchBar)) {
|
||||
this._setTouchBar((new TouchBar(touchBar)).toJSON())
|
||||
} else {
|
||||
this._setTouchBar(touchBar.toJSON())
|
||||
return
|
||||
}
|
||||
|
||||
if (Array.isArray(touchBar)) {
|
||||
touchBar = new TouchBar(touchBar)
|
||||
}
|
||||
|
||||
this._setTouchBar(touchBar.toJSON())
|
||||
touchBar._owner = this
|
||||
touchBar.items.forEach((item) => {
|
||||
item._owner = this
|
||||
|
|
Loading…
Reference in a new issue