initial work on updating touch bar item config without rerender

This commit is contained in:
Samuel Attard 2016-12-16 17:24:51 +11:00 committed by Kevin Sawicki
parent 61949657f0
commit dd09c91cf2
10 changed files with 98 additions and 27 deletions

View file

@ -44,6 +44,16 @@ class TouchBarItem {
}
}
updateConfig(newConfig) {
if (!this._owner) {
throw new Error('Cannot call methods on TouchBarItems without assigning to a BrowserWindow');
}
const dupConfig = Object.assign({}, newConfig);
delete dupConfig.id;
Object.assign(this.config, dupConfig);
this._owner._updateTouchBarItem(this.toJSON());
}
toJSON () {
return this.config
}