Module: global

A global mixin object containing commonly used methods and data.

Source:

Methods

(computed) isAdmin() → {boolean}

Checks if the user is an admin.

Source:
Returns:

True if the user is an admin, false otherwise.

Type
boolean

(method) cleanDateTime(dateTime) → {string}

Cleans the given date and time string by removing the seconds and replacing the 'T' separator with a space.

Parameters:
Name Type Description
dateTime string

The date and time string to be cleaned.

Source:
Returns:

The cleaned date and time string.

Type
string

(method) confirm(message) → {Promise.<boolean>}

Displays a confirmation dialog with the given message.

Parameters:
Name Type Description
message string

The message to display in the confirmation dialog.

Source:
Returns:
  • A promise that resolves to true if the user confirms, or false if the user cancels.
Type
Promise.<boolean>

(method) copyArray(from, to)

Copies the elements from one array to another.

Parameters:
Name Type Description
from Array

The source array.

to Array

The destination array.

Source:

(method) copyObject(from, to, preserveopt)

Copies properties from one object to another.

Parameters:
Name Type Attributes Description
from Object

The source object.

to Object

The destination object.

preserve boolean <optional>

Whether to preserve existing properties in the destination object. Defaults to false.

Source:

(method) equalArrays(a, b) → {boolean}

Checks if two arrays are equal by comparing their elements.

Parameters:
Name Type Description
a Array

The first array.

b Array

The second array.

Source:
Returns:
  • True if the arrays are equal, false otherwise.
Type
boolean

(method) equalObjects(a, b) → {boolean}

Checks if two objects are equal by comparing their properties.

Parameters:
Name Type Description
a Object

The first object to compare.

b Object

The second object to compare.

Source:
Returns:
  • Returns true if the objects are equal, false otherwise.
Type
boolean

(method) fileNameFromUrl(url) → {string}

Extracts the file name from a given URL.

Parameters:
Name Type Description
url string

The URL from which to extract the file name.

Source:
Returns:

The file name extracted from the URL.

Type
string

(method) formatDate(date) → {string}

Formats a date into a localized string.

Parameters:
Name Type Description
date Date

The date to be formatted.

Source:
Returns:

The formatted date string.

Type
string

(method) getCurrentPosition() → {Promise}

get the current position

Source:
Returns:
  • A promise that resolves to the current position.
Type
Promise

(method) getFileExtension(filename) → {string}

Retrieves the file extension from a given filename. Keeps "."" for compatibility with Path.GetExtension.

Parameters:
Name Type Description
filename string

The name of the file.

Source:
Returns:

The file extension.

Type
string

(method) loadStorable(data, routeName)

Loads storable data from local storage and assigns it to the corresponding properties in the data object.

Parameters:
Name Type Description
data Object

The data object containing the properties to be assigned.

routeName string

The name of the route or identifier for the storable data.

Source:

(method) parseTime(s, toSeconds) → {number|string}

Parses a time string and returns the parsed value. If the time string contains a blank, only the first part is considered.

Parameters:
Name Type Description
s string

The time string to parse.

toSeconds boolean

Indicates whether to return the parsed value in seconds.

Source:
Returns:
  • The parsed time value.
Type
number | string

(method) replaceIcons(text) → {string}

Replaces placeholders in the given text with corresponding Material Icons.

Parameters:
Name Type Description
text string

The text containing placeholders to be replaced.

Source:
Returns:

The modified text with placeholders replaced by Material Icons.

Type
string

(method) rgbaToHex(colorArray) → {string}

Converts an RGBA color array to a hexadecimal color string.

Parameters:
Name Type Description
colorArray Array.<number>

The RGBA color array.

Source:
Throws:

If the colorArray is not a valid RGBA color array.

Type
Error
Returns:

The hexadecimal color string.

Type
string

(method) roundTo(number, decimalPlaces) → {number}

Rounds a number to the specified decimal places.

Parameters:
Name Type Description
number number

The number to round.

decimalPlaces number

The number of decimal places to round to.

Source:
Returns:

The rounded number.

Type
number

(method) saveStorable(data, routeName)

Saves the storable data to local storage.

Parameters:
Name Type Description
data Object

The data object containing storable properties.

routeName string

The name of the route to save the data under.

Source:

(method) showError(err) → {Promise.<void>}

Displays an error dialog with the given error message.

Parameters:
Name Type Description
err string

The error message to display.

Source:
Returns:
  • A promise that resolves when the error dialog is closed.
Type
Promise.<void>

(method) showMessage(message) → {Promise.<void>}

Displays a dialog with the given message.

Parameters:
Name Type Description
message string

The message to display.

Source:
Returns:
  • A promise that resolves when the error dialog is closed.
Type
Promise.<void>

(method) splitDateComponents(inputDateTime) → {Object}

Splits a given date and time into its individual components.

Parameters:
Name Type Description
inputDateTime string

The input date and time string.

Properties:
Name Type Description
year number

The year component of the date.

month number

The month component of the date (1-12).

day number

The day component of the date.

hour number

The hour component of the time.

minute number

The minute component of the time.

second number

The second component of the time.

millisecond number

The millisecond component of the time.

Source:
Returns:

An object containing the individual components of the date and time.

Type
Object

(method) toStringIfNotNull(value) → {string}

Converts a value to a string if it is not null or undefined.

Parameters:
Name Type Description
value *

The value to convert to a string.

Source:
Returns:
  • The string representation of the value, or null if the value is null or undefined.
Type
string

(method) unitText(unit) → {string}

Returns the unit text with optional unit value.

Parameters:
Name Type Description
unit string

The unit value.

Source:
Returns:

The unit text with optional unit value.

Type
string