Event handlers for coach view design-time preview
The following functions can be used to provide an enhanced design-time experience, allowing user interface developers to visualize how a coach view will appear at run time. These functions are set up to parallel the run-time coach view APIs as closely as possible to allow for code reuse.
Function | Description |
---|---|
getHTMLSnippet() | Returns the HTML snippet as a String for the coach view design time rendering. If an HTML preview file has also been set on the coach view, then the content of this.htmlSnippet will be automatically set and returned. This function can be overridden to modify the snippet or, if an HTML preview is not specified, supply a template via coding. |
createPreview(containingDiv, labelText, callback) | Creates the preview for the coach view at design
time. If an HTML snippet has been supplied (by either a managed asset
or the getHTMLSnippet() function), then containingDiv will
have these contents:
|
destroyPreview() | Function called when the preview of the coach view instance is no longer being used. Use this function to clean up the resources that preview used when it was active. |
propertyChanged(propertyName, propertyValue) | Function called when the view instance is first
initialized and when a property changes. These changes are similar
to those returned by the modelChanged function except
the values are mapped to runtime values where possible. Some model facets are combined into one grouping. For example, one @style notification is returned containing all effective values for the current device selected, instead of separate notifications for @width, @height and so on. If the data type is a URL, for example in the case of a stock image binding, and a managed asset is chosen, then propertyValue is resolved to a usable URL or null if not found. If the configuration option is responsive, the effective value is passed in, which could be inherited from another screen size setting. If the value is a localization key, the value passed is the resolved value for the current locale. If the user selects a different screen size setting, the function is called with the property name @device.
|
modelChanged(propertyName, propertyValue) | Function called when the model changes. Notification is triggered by configuration data changes, or changes to the bound data (via the @binding property name) and layout item control ID(@layoutItemId).
|
this.context | Description |
---|---|
context.device | Provides the currently selected device in the editor. It is recommended that you use the propertyChanged() function instead. |
context.getManagedAssetUrl(fileName, assetType, projectAcronym, returnWithoutAssetName, pathInZip) | Returns a URL pointing to the managed asset
specified by fileName.
|