Utils
Various utility functions around building Telestion frontend apps.
Example¶
Functions¶
generateDashboardId()¶
Generates a unique identifier for a dashboard.
Returns¶
string
The generated dashboard identifier.
isUserDataUpToDate()¶
Checks if the user data is up-to-date with the current version of the application.
Parameters¶
userData¶
the user data to compare with the application version
undefined
|
{
dashboards
: Record
<string
, {
layout
: string
[][];
title
: string
;
}>;
version
: string
;
widgetInstances
: Record
<string
, {
configuration
: Record
<string
, Json
>;
type
: string
;
}>;
}
the user data to compare with the application version
dashboards¶
Record
<string
, {
layout
: string
[][];
title
: string
;
}> = ...
The user’s dashboards.
version¶
string
= ...
The version of the client that created this user data.
widgetInstances¶
Record
<string
, {
configuration
: Record
<string
, Json
>;
type
: string
;
}> = ...
The user’s widget instances.
currentVersion¶
string
the current version of the application
Returns¶
boolean
loadFileContents()¶
Loads the contents of a specified file.
Parameters¶
file¶
The file object to load contents from.
encoding¶
string
= 'utf-8'
The encoding to use while reading the file. Default is UTF-8.
Returns¶
Promise
<string
>
- A Promise that resolves with the contents of the file as a string. - If the file is empty, the Promise will be rejected with an error.
wait()¶
Internal
Waits for the specified amount of time before resolving the returned promise.
Parameters¶
timeout¶
number
The duration in milliseconds to wait before resolving.
Returns¶
Promise
<void
>
A promise that resolves after the specified time has elapsed.