WidgetApi.WidgetApi
Description
Contains APIs to allow registration for a widget type and creation/deletion of widgets on a dashboard
Properties
Properties
- addOrUpdateWidget: (
widgetType
: string
, state
: WidgetStateInfo
, id?
: string
, title?
: string
, isSingleton?
: boolean
) => void
Type declaration
- (
widgetType
, state
, id?
, title?
, isSingleton?
): void
Parameters
Name |
Type |
Description |
widgetType
|
string
|
The name of the widget type that will be created or updated |
state
|
WidgetStateInfo
|
- |
id?
|
string
|
The id of the widget, only needed when updating a widget |
title?
|
string
|
The title of the widget |
isSingleton?
|
boolean
|
Deprecated: This parameter has moved to registerWidgetType and is no longer honored here |
Returns
void
Description
Allows the developer to create or update an existing widget instance
- deleteWidget: (
widgetType
: string
, id?
: string
) => void
Type declaration
Parameters
Name |
Type |
Description |
widgetType
|
string
|
The name of the widget type that will be deleted |
id?
|
string
|
The id of the widget |
Returns
void
Description
Allows the developer to delete an existing widget instance
- getWidgetIDs: (
widgetType
: string
) => string
[]
Type declaration
Parameters
Name |
Type |
Description |
widgetType
|
string
|
The name of the widget type |
Returns
string
[]
An array of widget IDs
Description
Allows the developer to get the IDs of all widgets of a given type
Type declaration
- (
widgetType
, eventHandler
): void
Parameters
Name |
Type |
Description |
widgetType
|
string
|
The name of the widget type being deleted |
eventHandler
|
WidgetDeleteEventHandler
|
The callback function to be triggered |
Returns
void
Description
Allows the developer to register a callback triggered when a widget is deleted
Type declaration
- (
eventHandlerName
, eventHandler
): void
Parameters
Name |
Type |
Description |
eventHandlerName
|
string
|
A unique name for the callback function |
eventHandler
|
WidgetMenuEventHandler
|
The callback function to be triggered |
Returns
void
Description
Allows the developer to register a callback triggered when the widget's menu is created
- registerWidgetType: (
widgetType
: string
, factoryFn
: WidgetFactory
, loadingElement?
: HTMLDivElement
, displayName?
: string
, scriptOnly?
: boolean
) => void
Type declaration
- (
widgetType
, factoryFn
, loadingElement?
, displayName?
, scriptOnly?
): void
Parameters
Name |
Type |
Description |
widgetType
|
string
|
The name of the widget that will show under the "Add Widget" menu button |
factoryFn
|
WidgetFactory
|
The factory function that will be called back to create the widget instance |
loadingElement?
|
HTMLDivElement
|
Optional div element to be shown when widget is in a loading state |
displayName?
|
string
|
Optional string to display in add widget dropdown menu. Uses the 'widgetType' value if not given. |
scriptOnly?
|
boolean
|
Optional boolean to indicate if the widget will be created and closed by a script only |
Returns
void
Description
Allows the developer to register a widget type, where the factory function is
called when a new instance of the widget is added to a dashboard