Initializing help system before first use

ExtensionApi

Collection of helper functions available to VDL extensions.

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.
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

method
addBinding ( element, name, value ) → {ExtensionApi}

Add a binding to an element.

Parameters:
params
Name Type Description
element
type
Element
The DOM element to apply the binding to
name
type
string
The binding name
value
type
string
The binding expression
details
Returns:
returns table
Type Description
type
ExtensionApi
Back to Top
method
addEntities ( entityNames ) → {ExtensionApi}

Add entities to the view model.

Parameters:
params
Name Type Description
entityNames
type
string | Array.<string>
One or more entity names to add to the view model
details
Returns:
returns table
Type Description
type
ExtensionApi
Back to Top
method
addExternalScript ( src )

Adds a new external script include to the vdl page

Parameters:
params
Name Type Description
src
type
string
the source of the external script to include
details
Back to Top
method
addInlineScript ( scriptContent )

Adds a new inline script to the vdl page

Parameters:
params
Name Type Description
scriptContent
type
string
the script contents to add
details
Back to Top
method
addVirtualBinding ( elements, name, value, shouldMerge ) → {ExtensionApi}

Insert a virtual binding onto an element. Optionally merge with an existing virtual binding node if present.

Parameters:
params
Name Type Argument Default Description
elements
type
Element | Array.<Element>
The DOM element to apply the binding to, or an array of elements to wrap with the binding
name
type
string
The binding name
value
type
string
The binding expression
shouldMerge
type
boolean
optional  false Toggle merge into existing virtual binding, if present, otherwise creates a new virtual binding node
details
Throws:
exceptions
If the binding is not permitted to be used as a virtual binding
Returns:
returns table
Type Description
type
ExtensionApi
Back to Top
method
createDynamicVariable ( name, execTxt, isViewScoped ) → {function}

Tell the model builder to create a new dynamic variable and return it.

Parameters:
params
Name Type Description
name
type
string
execTxt
type
string
isViewScoped
type
boolean
details
Returns:
returns table
Type Description
type
function
the created dynamic variable
Back to Top
method
createId ( prefix ) → {string}

Generate an id that is unique during this application instance.

Parameters:
params
Name Type Argument Description
prefix
type
string
optional  prefix for the generated id
details
Returns:
returns table
Type Description
type
string
The generated id
Back to Top
method
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:
params
Name Type Description
element
type
Element
The element to apply the params to
details
Returns:
returns table
Type Description
type
ComponentParamsBuilder
The component params builder
Back to Top
method
getEntityReference ( name, scenarioId ) → {string}

Get the view model reference for an entity.

Parameters:
params
Name Type Argument Description
name
type
string
The name of the entity
scenarioId
type
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
details
Returns:
returns table
Type Description
type
string
The reference for the entity on the view model
Back to Top
method
getExtensionMetadata ( ) → {Array.<{name: string, tag: string, attributes: Array.<string>, modifiesDescendants: boolean}>}

Get metadata about the registered extensions.

details
Returns:
returns table
Type Description
type
Array.<{name: string, tag: string, attributes: Array.<string>, modifiesDescendants: boolean}>
Back to Top
method
getModelEntityByName ( entityName ) → {ModelEntity}

Get the metadata for a model entity.

Parameters:
params
Name Type Description
entityName
type
string
The entity name to fetch metadata for
details
Returns:
returns table
Type Description
type
ModelEntity
The entity or undefined if no entity exists with that name
Back to Top
method
getValidatorMetadata ( ) → {*|Array.<{name: string, doc: ExtensionDoc}>}

Get metadata about the registered validators.

details
Returns:
returns table
Type Description
type
* | Array.<{name: string, doc: ExtensionDoc}>
Back to Top
method
isValidScenario ( idOrIndex ) → {boolean}

Returns

Parameters:
params
Name Type Description
idOrIndex
type
string | number
the id or index of a scenario on the shelf.
details
Returns:
returns table
Type Description
type
boolean
whether scenario can be found.
Back to Top
method
preLoadAttachmentsOnAllScenarios ( ) → {ExtensionApi}

Pre-loads attachments for all scenarios

details
Returns:
returns table
Type Description
type
ExtensionApi
Back to Top
method
preLoadAttachmentsOnScenarios ( scenarios ) → {ExtensionApi}

Pre-loads attachments for scenarios

Parameters:
params
Name Type Description
scenarios
type
string | Array.<string>
One or more scenario index to pre-load
details
Returns:
returns table
Type Description
type
ExtensionApi
Back to Top
method
preLoadEntitiesOnAllScenarios ( entityNames ) → {ExtensionApi}

Pre-loads entities for all scenarios

Parameters:
params
Name Type Description
entityNames
type
string | Array.<string>
One or more entity names to pre-load
details
Returns:
returns table
Type Description
type
ExtensionApi
Back to Top
method
preLoadEntitiesOnScenarios ( entityNames, scenarios ) → {ExtensionApi}

Pre-loads entities for scenarios

Parameters:
params
Name Type Description
entityNames
type
string | Array.<string>
One or more entity names to pre-load
scenarios
type
string | Array.<string>
One or more scenario index to pre-load
details
Returns:
returns table
Type Description
type
ExtensionApi
Back to Top
method
preLoadParametersOnAllScenarios ( ) → {ExtensionApi}

Pre-loads parameters for all scenarios

details
Returns:
returns table
Type Description
type
ExtensionApi
Back to Top
method
preLoadParametersOnScenarios ( scenarios ) → {ExtensionApi}

Pre-loads parameters for scenarios

Parameters:
params
Name Type Description
scenarios
type
string | Array.<string>
One or more scenario index to pre-load
details
Returns:
returns table
Type Description
type
ExtensionApi
Back to Top
method
viewIsReady ( ) → {function}

Returns an observable which can be subscribed to and receives a callback when the view is ready

details
Returns:
returns table
Type Description
type
function
viewIsReady observable
Back to Top
method
viewIsValid ( ) → {function}

Returns an observable which can be subscribed to and receives a callback when the views validity is decided

details
Returns:
returns table
Type Description
type
function
viewIsValid observable
Back to Top

© 2001-2020 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.