ComponentParamsBuilder
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
A builder API to add, read and serialize component params to a DOM element.
Parameters:
Name | Type | Description |
---|---|---|
element |
type
Element |
The DOM element to add component params to |
Methods
- 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:
paramsName Type Description name typestringThe param name paramExpression typeStringA parsed VDL attribute expression argumentNames typeArrayAn array of argument names detailsReturns:returns tableType Description typeComponentParamsBuilderThe builder so calls can be chained - addParam ( name, value, isExpression ) → {ComponentParamsBuilder}
-
Add a component param.
Parameters:
paramsName Type Argument Default Description name typestringThe param name value typestring | boolean | numberThe param value isExpression typebooleanoptional false Is the param a dynamic expression detailsReturns:returns tableType Description typeComponentParamsBuilderThe builder so calls can be chained - addParentCallbackParam ( name ) → {*|ComponentParamsBuilder}
-
Add a component param which holds a reference to the named callback function in the parent extension.
Parameters:
paramsName Type Description name the name of the callback. detailsReturns:returns tableType Description type* | ComponentParamsBuilder - addRawOrExpressionParam ( name, vdlAttribute ) → {ComponentParamsBuilder}
-
Add a component param using a parsed VDL attribute. Automatically set the param as an expression if provided.
Parameters:
paramsName Type Description name typestringThe param name vdlAttribute typeVdlAttributeA parsed VDL attribute detailsReturns:returns tableType Description typeComponentParamsBuilderThe builder so calls can be chained - clearParams ( )
-
Clear all existing params from the element.
details - getParam ( name ) → {string|boolean|number}
-
Get the value for a specific param.
Parameters:
paramsName Type Description name typestringThe name of the param to fetch detailsReturns:returns tableType Description typestring | boolean | numberThe primitive value of the param - 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.
detailsReturns:returns tableType Description typestring | undefinedserialize representation of the params, undefined if no params set - hasParam ( name ) → {boolean}
-
Check for a specific name component param.
Parameters:
paramsName Type Description name typestringThe param name to check for detailsReturns:returns tableType Description typeboolean - hasParams ( ) → {boolean}
-
Check if the element has any component params.
detailsReturns:returns tableType Description typeboolean - isParamExpression ( name ) → {boolean}
-
Check whether a given param has been specified as a dynamic expression.
Parameters:
paramsName Type Description name typestringdetailsReturns:returns tableType Description typeboolean