Recent Changes - Search:

edit SideBar

DataTypes

Accessor parameters, inputs, and outputs follow a principle called gradual typing. If the XML definition of the input or output includes no type attribute, then any JavaScript type is acceptable. At this extreme, types are only checked at run time. But an accessor may constrain the type of an input, output, or parameter by including a type field.

The available types are still under discussion, but they will include at least:

  • boolean: true or false
  • int: an integer number
  • number: a JavaScript number (integer or floating point)
  • string: a string
  • JSON : a JavaScript value or object that has a JSON representation. The object will be converted to a JSON string by the send() function, and converted back to a native JavaScript value or object by the get() or getParameter() function.

For any of these data types except boolean, you can define a finite number of possible values (an enumeration), as in the following example:

    parameter('name', {'type':'string', 'value':'a', 'options':['a', 'b', 'c']});

Giving an options option defines the allowed values.


Back to Accessor Specification

Edit - History - Print - Recent Changes - Search
Page last modified on March 15, 2017, at 11:49 pm