widgets/osc: add support for null target item to disable osc sending

This commit is contained in:
jean-emmanuel 2017-10-05 11:12:24 +02:00
parent b67513625d
commit 9904f06742
4 changed files with 33 additions and 29 deletions

View file

@ -70,7 +70,7 @@ Osc.prototype.receive = function(data){
// if the message target is provided (when message comes from another client connected to the same server)
// then we only update the widgets that have the same target
// compare arrays using > and < operators (both false = equality)
if (!target || !(widget[i].getProp('target') < target || widget[i].getProp('target') > target)) {
if (!target || !(widget[i].getProp('target') < target || widget[i].getProp('target') > target || widget[i].getProp('target').length != target.length)) {
// update matching widgets
if (widget[i] && widget[i].setValue) widget[i].setValue(args,{send:false,sync:true,fromExternal:!target})
}

View file

@ -27,12 +27,12 @@ module.exports = class _widgets_base {
this.hash = _widgets_base.createHash()
// Turn preArgs into array
if (this.props.preArgs != undefined && !Array.isArray(this.resolveProp('preArgs', undefined, false))) {
if (this.props.preArgs !== undefined && !Array.isArray(this.resolveProp('preArgs', undefined, false))) {
this.props.preArgs = [this.props.preArgs]
}
// Turn preArgs into array
if (this.props.target != undefined && !Array.isArray(this.resolveProp('target', undefined, false))) {
if (this.props.target !== undefined && !Array.isArray(this.resolveProp('target', undefined, false))) {
this.props.target = [this.props.target]
}