Use SetTouchBar withe empty vector instead of DestroyTouchBar

This commit is contained in:
Kevin Sawicki 2017-03-01 11:05:34 -08:00
parent d5dbe3676e
commit 51f1c5a557
8 changed files with 11 additions and 25 deletions

View file

@ -199,20 +199,20 @@ Object.assign(BrowserWindow.prototype, {
// TouchBar API
setTouchBar (touchBar) {
// This property is set from within TouchBar
if (this._touchBar != null) {
this._touchBar._removeFromWindow(this)
}
if (touchBar == null) {
if (this._touchBar != null) {
this._touchBar._removeFromWindow(this)
}
this._destroyTouchBar()
this._setTouchBarItems([])
return
}
if (Array.isArray(touchBar)) {
touchBar = new TouchBar(touchBar)
}
this._touchBar = touchBar
this._touchBar._addToWindow(this)
touchBar._addToWindow(this)
}
})