Lurch web app user interface

Class

SettingsCategoryMetadata

A subclass of SettingMetadata that does not actually correspond to just one setting, but to a sequence of settings collected together into a named category. This is useful for presenting settings to the user with a sensible organization into tabs/pages with appropriate names/headings.

Constructor

new SettingsCategoryMetadata(name, …contents)

Create a new metadata item for a category of settings

Parameters

  • name String

    the name of the category, used as a title in the user interface when presenting this category to the user for editing

  • contents Array.<SettingMetadata> <repeatable>

    the metadata for each setting in this catyegory, in the order they should be shown to the user when editing

Source

Classes

SettingsCategoryMetadata

Methods

defaultSettings() → {Object}

For all settings in this category, 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 category

Source

keys() → {Array.<String>}

Creates an ordered list of all the names of all the settings in this category. (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 category

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 category. 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 category

Source

validate()

Validate all the settings in this category 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