Initial support for dynamic properties
This commit is contained in:
parent
cbb6f8c33e
commit
98f5858b11
10 changed files with 46 additions and 33 deletions
|
@ -138,6 +138,8 @@ BrowserWindow.prototype._init = function () {
|
|||
this._touchBar.emit('interaction', id, details)
|
||||
}
|
||||
})
|
||||
|
||||
this._touchBarListener = this._refreshTouchBarItem.bind(this)
|
||||
}
|
||||
|
||||
BrowserWindow.getFocusedWindow = () => {
|
||||
|
@ -208,8 +210,11 @@ Object.assign(BrowserWindow.prototype, {
|
|||
// TouchBar API
|
||||
BrowserWindow.prototype.setTouchBar = function (touchBar) {
|
||||
if (touchBar == null) {
|
||||
if (this._touchBar != null) {
|
||||
this._touchBar.removeListener('change', this._touchBarListener)
|
||||
this._touchBar = null
|
||||
}
|
||||
this._destroyTouchBar()
|
||||
this._touchBar = null
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -218,11 +223,8 @@ BrowserWindow.prototype.setTouchBar = function (touchBar) {
|
|||
}
|
||||
|
||||
this._touchBar = touchBar
|
||||
this._touchBar.on('change', this._touchBarListener)
|
||||
this._setTouchBar(touchBar.ordereredItems)
|
||||
}
|
||||
|
||||
BrowserWindow.prototype._updateTouchBarItem = function (itemID) {
|
||||
this._refreshTouchBarItem(itemID)
|
||||
}
|
||||
|
||||
module.exports = BrowserWindow
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue