widgets: osc: allow changing server-side cached osc props without sending all of them

This commit is contained in:
jean-emmanuel 2018-02-04 23:32:13 +01:00
parent d00eedc5f8
commit 5c5adebabb
2 changed files with 13 additions and 14 deletions

View file

@ -224,7 +224,10 @@ module.exports = {
widgetHashTable[clientId] = {}
}
widgetHashTable[clientId][data.hash] = data.data
for (var k in data.data) {
widgetHashTable[clientId][data.hash][k] = data.data[k]
}
},
removeWidget(data, clientId) {

View file

@ -21,17 +21,7 @@ var WidgetManager = class WidgetManager extends EventEmitter {
ipc.on('reconnect', ()=>{
for (var hash in this.widgets) {
ipc.send('addWidget', {
hash:hash,
data:{
precision: this.widgets[hash].getProp('precision'),
preArgs: this.widgets[hash].getProp('preArgs'),
split: this.widgets[hash].split,
target: this.widgets[hash].getProp('target'),
address: this.widgets[hash].getProp('address'),
noSync: this.widgets[hash].getProp('noSync'),
}
})
this.registerWidget(this.widget[hash])
}
})
@ -105,9 +95,15 @@ var WidgetManager = class WidgetManager extends EventEmitter {
this.scrollingWidgets.push(hash)
}
this.registerWidget(widget)
}
registerWidget(widget, data) {
ipc.send('addWidget', {
hash:hash,
data:{
hash: widget.hash,
data: data || {
precision: widget.getProp('precision'),
preArgs: widget.getProp('preArgs'),
split: widget.split,