Index
The Telestion Frontend Library.
Import this library to use the Telestion Frontend:
The most important function is initTelestion. It initializes the Telestion Frontend and renders the application.
See¶
Interfaces¶
TelestionOptions¶
Represents the options for Telestion.
Properties¶
defaultBackendUrl?¶
The backend URL that should be inserted by default on first page load.
defaultUserData?¶
Represents the default user data.
dashboards¶
The user’s dashboards.
version¶
The version of the client that created this user data.
widgetInstances¶
The user’s widget instances.
version¶
Represents the current version of the software.
widgets?¶
Represents an array of widgets.
Widget<T>¶
A widget that can be used in widget instances on dashboards.
See¶
userData.WidgetInstance
Type Parameters¶
• T extends BaseWidgetConfiguration
= BaseWidgetConfiguration
the type of the widget configuration
Properties¶
configElement¶
A configuration element that is used to configure the widget.
element¶
A function that takes the configuration of the widget and returns a React element that represents the widget.
id¶
Represents an identifier of the widget type.
label¶
Represents a human-readable label of the widget type.
Methods¶
createConfig()¶
A function that takes an object that contains the previous widget configuration (which may or may not be from a previous version of the client (or could also, when creating new widget instances, be empty) and returns a valid configuration for the widget.
For widgets with expected breaking changes, it is therefore useful to have some version identifier be a part of the configuration options to enable more complex migration logic in this function.
Parameters¶
input¶
Partial
<T
> & Record
<string
, Json
>
previous configuration or empty
Returns¶
T
Type Aliases¶
UserData¶
Represents the user data.
Type declaration¶
dashboards¶
The user’s dashboards.
version¶
The version of the client that created this user data.
widgetInstances¶
The user’s widget instances.
See¶
Functions¶
JSONCodec()¶
Returns a Codec for encoding JavaScript object to JSON and serialize them to an Uint8Array, and conversely, from an Uint8Array to JSON to a JavaScript Object.
Type Parameters¶
• T = unknown
Parameters¶
reviver?¶
(this
, key
, value
) => unknown
Returns¶
Codec
<T
>
registerWidgets()¶
Registers widgets in the widget store.
If a widget with the same ID already exists in the widget store, a warning is logged and the widget is ignored.
Parameters¶
widgets¶
…Widget
<Record
<string
, Json
>>[]
The widgets to be registered.
Returns¶
void
useNats()¶
Returns¶
useWidgetConfig()¶
Retrieves the widget configuration from the widgetConfigContext.
Type Parameters¶
• T
The type of the widget configuration.
Returns¶
T
The widget configuration retrieved from the widgetConfigContext.
Throws¶
Error Throws an error if useWidgetConfig is not used within a WidgetConfigProvider.
References¶
initTelestion¶
Re-exports initTelestion