Loopback VirtualParameters - good or evil?

Dan Morphis dan at milkcarton.com
Mon Jul 3 09:30:59 EDT 2017


args is used to pass parameters in. The documentation on the wiki should be up to date. I use v-params in my setup with no issues. 

-dan

> On Jul 3, 2017, at 1:42 AM, Alexander Münn <muenn at telta.de> wrote:
> 
> Hello,
> 
> One of my provision scripts generates some values that need to be exported so that they become readable from the GUI. First, I thought using VirtualParameters in this case is straight forward, but ended up with try and error. Mostly because the documentation at [1] seems to be a bit out-dated? It states that "Virtual parameter scripts don't have the variable args" and further "Virtual parameter scripts have the variables timestamps and values.".
> In contrast the sandbox doesn't provide either 'timestamps' or 'values' variable. Instead I see the args array containing always(?) four objects. After some experimenting my interpretation of each element is:
> 
> args[0] - reference timestamp on read access; empty on set
> args[1] - value object for writes; empty on get
> args[2] - some timestamps ?
> args[3] - last read value from device parameters
> 
> On top of that I'm using following (loopback) VirtualParameter definition:
> 
> const next = args[1];
> const last = args[3];
> 
> /* default value */
> if (!last.value) {
>   last.value = ["", "xsd:string"];
> }
> 
> return {writable: true, value: next.value ? next.value : last.value};
> 
> 
> I'd like to discuss this "feature". Does anybody already use this or something similar? Is the calling API to virtual parameter scripts stable in this way?  --Alex
> 
> 
> [1] https://github.com/zaidka/genieacs/wiki/Virtual-Parameters
> 
> _______________________________________________
> Users mailing list
> Users at lists.genieacs.com
> http://lists.genieacs.com/mailman/listinfo/users


More information about the Users mailing list