Initializing help system before first use

ComponentParamsBuilder

A builder API to add, read and serialize component params to a DOM element.

Method summary

name description
addFunctionOrExpressionParam Add a an expression component param, which should resolve to either a function or a javascript expression. If it resolves to an expression, it will be wrapped into a function, which takes arguments specified in params argument.
addParam Add a component param.
addParentCallbackParam Add a component param which holds a reference to the named callback function in the parent extension.
addRawOrExpressionParam Add a component param using a parsed VDL attribute. Automatically set the param as an expression if provided.
clearParams Clear all existing params from the element.
getParam Get the value for a specific param.
getSerializedParams Serialize the component params on the element in a compatible way, i.e. do not wrap expression in quotes. Values that are an object of type {value: string, isExpression: true} will not be wrapped in quotes so VDL will treat them as expressions.
hasParam Check for a specific name component param.
hasParams Check if the element has any component params.
isParamExpression Check whether a given param has been specified as a dynamic expression.
constructor

Constructor

new ComponentParamsBuilder ( element )

A builder API to add, read and serialize component params to a DOM element.

Parameters:
params
Name Type Description
element
type
Element
The DOM element to add component params to
details

Methods

method
addFunctionOrExpressionParam ( name, paramExpression, argumentNames ) → {ComponentParamsBuilder}

Add a an expression component param, which should resolve to either a function or a javascript expression. If it resolves to an expression, it will be wrapped into a function, which takes arguments specified in params argument.

Parameters:
params
Name Type Description
name
type
string
The param name
paramExpression
type
String
A parsed VDL attribute expression
argumentNames
type
Array
An array of argument names
details
Returns:
returns table
Type Description
type
ComponentParamsBuilder
The builder so calls can be chained
Back to Top
method
addParam ( name, value, isExpression ) → {ComponentParamsBuilder}

Add a component param.

Parameters:
params
Name Type Argument Default Description
name
type
string
The param name
value
type
string | boolean | number
The param value
isExpression
type
boolean
optional  false Is the param a dynamic expression
details
Returns:
returns table
Type Description
type
ComponentParamsBuilder
The builder so calls can be chained
Back to Top
method
addParentCallbackParam ( name ) → {*|ComponentParamsBuilder}

Add a component param which holds a reference to the named callback function in the parent extension.

Parameters:
params
Name Type Description
name the name of the callback.
details
Returns:
returns table
Type Description
type
* | ComponentParamsBuilder
Back to Top
method
addRawOrExpressionParam ( name, vdlAttribute ) → {ComponentParamsBuilder}

Add a component param using a parsed VDL attribute. Automatically set the param as an expression if provided.

Parameters:
params
Name Type Description
name
type
string
The param name
vdlAttribute
type
VdlAttribute
A parsed VDL attribute
details
Returns:
returns table
Type Description
type
ComponentParamsBuilder
The builder so calls can be chained
Back to Top
method
clearParams ( )

Clear all existing params from the element.

details
Back to Top
method
getParam ( name ) → {string|boolean|number}

Get the value for a specific param.

Parameters:
params
Name Type Description
name
type
string
The name of the param to fetch
details
Returns:
returns table
Type Description
type
string | boolean | number
The primitive value of the param
Back to Top
method
getSerializedParams ( ) → {string|undefined}

Serialize the component params on the element in a compatible way, i.e. do not wrap expression in quotes. Values that are an object of type {value: string, isExpression: true} will not be wrapped in quotes so VDL will treat them as expressions.

details
Returns:
returns table
Type Description
type
string | undefined
serialize representation of the params, undefined if no params set
Back to Top
method
hasParam ( name ) → {boolean}

Check for a specific name component param.

Parameters:
params
Name Type Description
name
type
string
The param name to check for
details
Returns:
returns table
Type Description
type
boolean
Back to Top
method
hasParams ( ) → {boolean}

Check if the element has any component params.

details
Returns:
returns table
Type Description
type
boolean
Back to Top
method
isParamExpression ( name ) → {boolean}

Check whether a given param has been specified as a dynamic expression.

Parameters:
params
Name Type Description
name
type
string
details
Returns:
returns table
Type Description
type
boolean
Back to Top