widgets: target: make 'null' token disable the global default target (#279)

This commit is contained in:
jean-emmanuel 2018-05-04 21:25:15 +02:00
parent 47340cb5eb
commit bcda3d3a06
3 changed files with 8 additions and 5 deletions

View file

@ -4,7 +4,8 @@
- widgets
- `target` and `preArgs` properties are no longer coerced to arrays and can be written as single string values
- `linkId` supports master and slave mode with `>>` and `>>` prefixes
- `linkId` supports master and slave mode with `>>` and `>>` prefixes
- the special `target` token `null` can now be used in conjunction with regular targets, it disables the default global targets set via the `--send` option
## 0.29.2

View file

@ -176,18 +176,20 @@ module.exports = {
data.args = data.preArgs ? data.preArgs.concat(value) : [value]
if (!data.target || data.target.indexOf(null) == -1) {
if (data.target) {
var targets = []
if (settings.read('targets') && !shortdata.target) Array.prototype.push.apply(targets, settings.read('targets'))
if (data.target.indexOf(null) === -1 && settings.read('targets') && !shortdata.target) Array.prototype.push.apply(targets, settings.read('targets'))
if (data.target) Array.prototype.push.apply(targets, data.target)
for (var i in targets) {
if (targets[i] == 'self') {
if (targets[i] === 'self') {
ipc.send('receiveOsc',data,clientId)
continue
} else if (targets[i] === null) {
continue
}
var host = targets[i].split(':')[0],

View file

@ -90,7 +90,7 @@ All widgets share a set of generic properties described below.
- if [`midi`](../extras/midi.md) is enabled, targets can be `"midi:device_name"`
- special item `"self"` can be used to refer to the emitting client directly
- if no target is set (empty array `[]`), messages can still be sent if the server has defaults targets (`-s / --send`)
- to disable osc regardless of the previous point, set `target` to `[null]`
- to disable the default global osc targets (set via the app's `--send` option), set one of the array's item as `null` (unquoted).
### `address`<i class="dynamic-prop-icon" title="dynamic"></i>
- type: `string`