remote control: make /GET reply to /GET (with widget address in args) (issue #56)

This commit is contained in:
jean-emmanuel 2017-12-21 07:34:23 +01:00
parent 279663d53f
commit 9651b2871c
2 changed files with 44 additions and 4 deletions

View file

@ -28,6 +28,46 @@ Apply a set of options to an existing widget by merging them to the widget's opt
!!! warning ""
Editing a widget can be cpu expensive, hence updating the UI continuously is not a good idea
## `/EDIT/GET target id`
Sends back a widget's data (JSON stringified object), including its children, to specified target.
- `target`: `string`, `ip:port` pair
- `id`: `string`, widget's `id`
Returns `/EDIT/GET id data`
- `id`: `string`
- `data`: `string`
## `/GET target id`
Sends back a widget's value to specified target.
- `target`: `string`, `ip:port` pair
- `id`: `string`, widget's `id`
Returns `/GET id value`
- `id`: `string`
- `value`: `*`
## `/GET target address preArg1 preArg2 ...`
Sends back a widget's value to specified target.
- `target`: `string`, `ip:port` pair
- `address`: `string`, widget's `address`
- `preArg[1...]`: `*`, widget's `preArgs`
Returns `/GET address preArg1 preArg2 ... value`
- `id`: `string`
- `address`: `string`, widget's `address`
- `preArg[1...]`: `*`, widget's `preArgs`
- `value`: `*`
## `/TABS id id etc`
Open the tabs designated by the `id` parameters. The target tab link must be accesible (opening a tab located in a disabled tab won't work unless you specify the parent tab's `id` before; the safest way to go is to pass the whole tab tree to enable).

View file

@ -56,7 +56,7 @@ var callbacks = {
],
nosync: true
})
}
},
'/GET':function(args) {
@ -76,12 +76,12 @@ var callbacks = {
}
if (!widgets.length) return
for (var i = widgets.length - 1; i >= 0; i--) {
return widgets[i].sendValue({
target:[target],
target: [target],
address: '/GET',
preArgs: [idOrAddress, ...preArgs],
nosync: true
})