Skip to main content

ARGS Question

2 replies [Last post]
grayside
Offline
Joined: 2009-03-09
Points: 0

How can I know the value in args. I could get some key-value pairs such as
args.id and args.topic. I would like to know how to get the others...

Thank you very much

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
gmurray71
Offline
Joined: 2003-07-31
Points: 0

Hi Grayside,

The top level wargs contains the following properties:

Example a function foo would be

jmaki.widgets.foo.Widget(wargs) {

// some logic here

}

The wargs is a object with the following properties:

1) uuid - A string unique id provided as the id property on a jMaki component or autogenerated
2) publish - a string (there is only one)
3) subscribe - a string or a array of strings to which a component subscribes to. You can also pass in custom handlers for specifc topics using an array like [ { topic : '/foo', handler : function(args) {} } ] but this is not common.
4) args - An object which is grab bag of whatever properties provided as part of the args attribute on a jmaki component. This can also include functions. The only requirement is that it needs to be correctly formatted JavaScript.
5) value - If the value was provided as an attribute it is a JavaScript object
6) service - The service attribute as a string if it was specified.

The only guaranteed/required property is the uuid.

In the past we used the used to pass in the topic as an one of the args but we have moved away from that convention. You can still do it but generally specifying the publish / subscribe directly as attributes is the better way to go.

Hope this makes things more clear.

-Greg

castertroy
Offline
Joined: 2009-04-01
Points: 0

thanks Greg. This has been very helpful