User-settings API
chevron down
 

User-settings API

Variable: preferences

Type: Preferences

The User Settings API provides access to User preferences.

import { preferences } from "user-settings";
console.log(preferences.clockDisplay);

Variable: exercise

Type: ExerciseSettings

The User Settings API provides access to Exercise settings.

import { exercise } from "user-settings";
console.log(exercise.poolLength);

Variable: locale

Type: LocaleSettings

The User Settings API provides access to Locale settings.

import { locale } from "user-settings";
console.log(locale.language);

Variable: units

Type: UnitsSettings

The User Settings API provides access to Units settings.

import { units } from "user-settings";
console.log(units.temperature);

Interface: Preferences

User preferences for the current user.

Properties

readonly clockDisplay

"12h" or "24h"

Indicates whether clocks and time values should use a 12h (AM/PM) or 24h format

readonly firstDayOfWeek

0 or 1

Indicates what day should be considered the first day of the week.

The value is a day index that has the same meaning as the day index returned by the JavaScript function Date.prototype.getDay():

0 for Sunday, 1 for Monday.

Interface: ExerciseSettings

Settings related to exercises.

Properties

readonly poolLength

number

Swimming pool length, in meters.

Interface: LocaleSettings

Locale settings are settings that relate to a user's preferred language.

Properties

readonly language

string

BCP 47 language tag.

Interface: UnitsSettings

User settings for units.

Unit settings indicate the preferred units to use when displaying values that have an associated unit.

These unit preferences may be units or families of units. The appropriate unit from a family should be chosen based on the magnitude of the value and its context. For example, short distances with a "metric" unit may be displayed as "m" or "km" depending on the context.

  • The unit family "us" means the United States Customary System (USCS or USC)
  • The unit family "metric" means the International System of Units (SI)

Properties

readonly bodyWeight

"metric" or "us" or "stone"

Unit family to use for body weight (or, more accurately, body mass).

  • "metric": typically kilograms
  • "us": typically pounds
  • "stone": stones
readonly distance

"metric" or "us"

Unit family to use for distances.

  • "metric": typically meters or kilometers
  • "us": typically feet or miles
readonly height

"metric" or "us"

Unit family to use for a person's height.

  • "metric": meters or centimeters
  • "us": feet and inches
readonly speed

"metric" or "us"

Unit family to use for speeds.

  • "metric": typically kilometers per hour
  • "us": typically miles per hour
readonly temperature

"C" or "F"

Unit family to use for temperatures.

  • "C": Celsius scale
  • "F": Fahrenheit scale
readonly volume

"metric" or "us"

Unit family to use for volumes (volume of liquid for example).

  • "metric": typically liters
  • "us": typically fluid ounces
readonly weight

"metric" or "us"

Unit family to use for a weight (or, more accurately, a mass) other than body weight.

  • "metric": typically kilograms
  • "us": typically pounds