Namespace chip.types
The namespace for the CHIP API's types contract, which allows the CHIP
to offer multiple visualizations from which the page builder can choose.
Defined in: actions.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
| Method Attributes | Method Name and Description |
|---|---|
| <static> |
chip.types.attachTypeChange(fnHandler)
Attaches the given event handler to the change event which is fired whenever the page builder
wants to change the current type of visualization.
|
| <static> |
chip.types.getAvailableTypes()
Returns the list of available types of visualization.
|
Method Detail
<static>
chip.types.attachTypeChange(fnHandler)
Attaches the given event handler to the change event which is fired whenever the page builder
wants to change the current type of visualization. The CHIP has to react accordingly and
change the visualization after the handler is called. The event handler should return a
jQuery.Deferred object's promise to inform the caller whether the visualization
has been changed (or failed). In the latter case an error message should be provided.
In case the type was changed before the handler was attached, the handler gets called
immediately after registration. This also works when the handler is overwritten by a
different one.
Use Function.prototype.bind() to determine the event handler's
this or some of its arguments.
Note: Without such an event handler, it will not be possible to change the visualization of
the CHIP during runtime.
- Parameters:
- {function (string)} fnHandler
- the handler for changing the visualization type of the CHIP. The first argument will be
the set type. The function must return a
jQuery.Deferredobject's promise.
- Since:
- 1.32.0
- Throws:
- Error if
fnHandleris not a function or if fnHandler. - If fnHandler is directly called (because a type was cached) and throws an error.
<static>
{string[]}
chip.types.getAvailableTypes()
Returns the list of available types of visualization. The types are always lower case.
- Since:
- 1.32.0
- Returns:
- {string[]} the available tile types in lower case, e.g.
["tile", "link"]