Lurch web app user interface

Class

SettingsMetadata

A subclass of SettingMetadata that does not actually correspond to just one setting, but to an entire collection of settings, organized into categories. So the singular SettingMetadata is for just one, and those are collected into categories using SettingsCategoryMetadata, and those categories are collected into the full set of settings for an app using this class, SettingsMetadata (the plural of SettingMetadata).

Because each SettingsCategoryMetadata will be presented to the user as a tab on a dialog, and this class represents several categories, it is presented to the user as a dialog with one or more tabs, one for each category contained in this collection.

Constructor

new SettingsMetadata(…categories)

Create a collection of settings categories

Parameters

  • categories Array.<SettingsCategoryMetadata> <repeatable>

    the categories in this settings collection, in the order they should be shown to the user when editing settings

Source

Classes

SettingsMetadata

Methods

defaultSettings() → {Object}

For all settings in this collection, look up their default values and return the result as an object mapping setting names to those default values.

Returns

  • Object

    a set of key-value pairs mapping names of settings to their default values for all settings in this collection

Source

keys() → {Array.<String>}

Creates an ordered list of all the names of all the settings in this collection. (The "name" of each setting is used as the "key" in any key-value dictionary representing settings, hence the term "keys.")

Returns

  • Array.<String>

    the keys in the order they appear in this collection

Source

metadataFor(key) → {SettingMetadata}

Given a setting's name, we can look up its metadata and return the appropriate SettingMetadata instance, if one with that name exists in this collection. Otherwise, we return undefined.

Parameters

  • key String

    the name of the setting whose metadata we should look up

Returns

  • SettingMetadata

    the metadata in question, or undefined if no such metadata exists in this collection

Source

validate()

Validate all the settings in all the categories and return all their error messages concatenated into a single array. If there were no error messages (which is the default) then the result will be an empty list, indicating that the data passes validation. See validate() for details.

Source