osc-receiver: allow non string values
This commit is contained in:
parent
aa844250d1
commit
a53c236afb
3 changed files with 13 additions and 4 deletions
|
|
@ -3,7 +3,7 @@
|
|||
## 0.33.0
|
||||
|
||||
- bug fixes
|
||||
- osc receivers not properly unregistered when widgets are recreated (memory leak)
|
||||
- osc receivers: not properly unregistered when widgets are recreated (memory leak); allow non-string values (eg. objects)
|
||||
- widgets
|
||||
- **new** generic `matrix` widget
|
||||
- fader: restore right-click focusing the input in compact mode (mouse only)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,12 @@ module.exports = class OscReceiver {
|
|||
|
||||
constructor(address, value, parent, propName) {
|
||||
|
||||
this.value = value
|
||||
try {
|
||||
this.value = JSON.parse(value)
|
||||
} catch (err) {
|
||||
this.value = value
|
||||
}
|
||||
|
||||
this.parent = parent
|
||||
this.propName = propName
|
||||
this.bindedCallback = this.callback.bind(this)
|
||||
|
|
@ -37,7 +42,12 @@ module.exports = class OscReceiver {
|
|||
var val = args.slice(preArgs.length)
|
||||
if (val.length < 2) val = val[0]
|
||||
if (val !== this.value) {
|
||||
this.value = val
|
||||
try {
|
||||
this.value = JSON.parse(val)
|
||||
} catch (err) {
|
||||
this.value = val
|
||||
}
|
||||
console.log(this.value)
|
||||
this.parent.updateProps([this.propName], this.parent)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -357,7 +357,6 @@ class Widget extends EventEmitter {
|
|||
}
|
||||
|
||||
var r = this.oscReceivers[address].value
|
||||
r = typeof r != 'string' ? JSON.stringify(r) : r
|
||||
|
||||
var varname = 'VAR_' + varnumber
|
||||
varnumber++
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue