ExtensionApi
Method summary
name | description |
---|---|
addBinding | Add a binding to an element. |
addEntities | Add entities to the view model. |
addExternalScript | Adds a new external script include to the vdl page |
addInlineScript | Adds a new inline script to the vdl page |
addVirtualBinding | Insert a virtual binding onto an element. Optionally merge with an existing virtual binding node if present. |
buildEntityOrParam | Builds the expression to access the entity or parameter, unpacking indices if needed. To be used within VDL extensions transform function. You need to add a virtual binding with the scenarioId passed into the extension so that it can access the correct scenario. |
createDynamicVariable | Tell the model builder to create a new dynamic variable and return it. |
createId | Generate an id that is unique during this application instance. |
getComponentParamsBuilder | Get a component params builder for a given element. This will allow you to apply component params to the element as well as inspecting existing ones and serialising the params to add to the DOM. |
getEntityReference | Get the view model reference for an entity. |
getExtensionMetadata | Get metadata about the registered extensions. |
getModelEntityByName | Get the metadata for a model entity. |
getValidatorMetadata | Get metadata about the registered validators. |
isValidScenario | Returns |
preLoadAttachmentsOnAllScenarios | Pre-loads attachments for all scenarios |
preLoadAttachmentsOnScenarios | Pre-loads attachments for scenarios |
preLoadEntitiesOnAllScenarios | Pre-loads entities for all scenarios |
preLoadEntitiesOnScenarios | Pre-loads entities for scenarios |
preLoadParametersOnAllScenarios | Pre-loads parameters for all scenarios |
preLoadParametersOnScenarios | Pre-loads parameters for scenarios |
viewIsReady | Returns an observable which can be subscribed to and receives a callback when the view is ready |
viewIsValid | Returns an observable which can be subscribed to and receives a callback when the views validity is decided |
Methods
- addBinding ( element, name, value ) → {ExtensionApi}
-
Add a binding to an element.
Parameters:
Name Type Description element Element The DOM element to apply the binding to name string The binding name value string The binding expression Returns:Type Description ExtensionApi - addEntities ( entityNames ) → {ExtensionApi}
-
Add entities to the view model.
Parameters:
Name Type Description entityNames string | Array.<string> One or more entity names to add to the view model Returns:Type Description ExtensionApi - addExternalScript ( src )
-
Adds a new external script include to the vdl page
Parameters:
Name Type Description src string the source of the external script to include - addInlineScript ( scriptContent )
-
Adds a new inline script to the vdl page
Parameters:
Name Type Description scriptContent string the script contents to add - addVirtualBinding ( elements, name, value, shouldMerge ) → {ExtensionApi}
-
Insert a virtual binding onto an element. Optionally merge with an existing virtual binding node if present.
Parameters:
Name Type Argument Default Description elements Element | Array.<Element> The DOM element to apply the binding to, or an array of elements to wrap with the binding name string The binding name value string The binding expression shouldMerge boolean optional false Toggle merge into existing virtual binding, if present, otherwise creates a new virtual binding node Throws:
If the binding is not permitted to be used as a virtual bindingReturns:Type Description ExtensionApi - buildEntityOrParam ( attributes ) → {Object}
-
Builds the expression to access the entity or parameter, unpacking indices if needed. To be used within VDL extensions transform function. You need to add a virtual binding with the scenarioId passed into the extension so that it can access the correct scenario.
Parameters:
Name Type Description attributes Object.<string, VdlAttribute> Attributes from the VDL extension being transformed Returns:Type Description Object An entity access expression - createDynamicVariable ( name, execTxt, isViewScoped ) → {function}
-
Tell the model builder to create a new dynamic variable and return it.
Parameters:
Name Type Description name string execTxt string isViewScoped boolean Returns:Type Description function the created dynamic variable - createId ( prefix ) → {string}
-
Generate an id that is unique during this application instance.
Parameters:
Name Type Argument Description prefix string optional prefix for the generated id Returns:Type Description string The generated id - getComponentParamsBuilder ( element ) → {ComponentParamsBuilder}
-
Get a component params builder for a given element. This will allow you to apply component params to the element as well as inspecting existing ones and serialising the params to add to the DOM.
Parameters:
Name Type Description element Element The element to apply the params to Returns:Type Description ComponentParamsBuilder The component params builder - getEntityReference ( name, scenarioId ) → {string}
-
Get the view model reference for an entity.
Parameters:
Name Type Argument Description name string The name of the entity scenarioId number optional The scenario index to get the entity from, if not specified it will fall back to and expression that resolves to either the current scenario in context (when Knockout is bound) or the first scenario Returns:Type Description string The reference for the entity on the view model - getExtensionMetadata ( ) → {Array.<{name: string, tag: string, attributes: Array.<string>, modifiesDescendants: boolean}>}
-
Get metadata about the registered extensions.
Returns:Type Description Array.<{name: string, tag: string, attributes: Array.<string>, modifiesDescendants: boolean}> - getModelEntityByName ( entityName ) → {ModelEntity}
-
Get the metadata for a model entity.
Parameters:
Name Type Description entityName string The entity name to fetch metadata for Returns:Type Description ModelEntity The entity or undefined if no entity exists with that name - getValidatorMetadata ( ) → {*|Array.<{name: string, doc: ExtensionDoc}>}
-
Get metadata about the registered validators.
Returns:Type Description * | Array.<{name: string, doc: ExtensionDoc}> - isValidScenario ( idOrIndex ) → {boolean}
-
Returns
Parameters:
Name Type Description idOrIndex string | number the id or index of a scenario on the shelf. Returns:Type Description boolean whether scenario can be found. - preLoadAttachmentsOnAllScenarios ( ) → {ExtensionApi}
-
Pre-loads attachments for all scenarios
Returns:Type Description ExtensionApi - preLoadAttachmentsOnScenarios ( scenarios ) → {ExtensionApi}
-
Pre-loads attachments for scenarios
Parameters:
Name Type Description scenarios string | Array.<string> One or more scenario index to pre-load Returns:Type Description ExtensionApi - preLoadEntitiesOnAllScenarios ( entityNames ) → {ExtensionApi}
-
Pre-loads entities for all scenarios
Parameters:
Name Type Description entityNames string | Array.<string> One or more entity names to pre-load Returns:Type Description ExtensionApi - preLoadEntitiesOnScenarios ( entityNames, scenarios ) → {ExtensionApi}
-
Pre-loads entities for scenarios
Parameters:
Name Type Description entityNames string | Array.<string> One or more entity names to pre-load scenarios string | Array.<string> One or more scenario index to pre-load Returns:Type Description ExtensionApi - preLoadParametersOnAllScenarios ( ) → {ExtensionApi}
-
Pre-loads parameters for all scenarios
Returns:Type Description ExtensionApi - preLoadParametersOnScenarios ( scenarios ) → {ExtensionApi}
-
Pre-loads parameters for scenarios
Parameters:
Name Type Description scenarios string | Array.<string> One or more scenario index to pre-load Returns:Type Description ExtensionApi - viewIsReady ( ) → {function}
-
Returns an observable which can be subscribed to and receives a callback when the view is ready
Returns:Type Description function viewIsReady observable - viewIsValid ( ) → {function}
-
Returns an observable which can be subscribed to and receives a callback when the views validity is decided
Returns:Type Description function viewIsValid observable
© 2001-2024 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.