Class Setting<SerializedType, DeserializedType>

Refers to a specific setting on the configuration. Should be initialized with a raw (serialized) type and an actual (deserialized) type.

This is used for both client and wiki-wide configuration.

Type Parameters

  • SerializedType
  • DeserializedType

Constructors

Properties

allowedValues?: Record<string, DeserializedType> | DeserializedType[]

Allowed values for this setting. Specific values may be provided, or an object of "choice objects": value mapped by the choice label (to be used to get the choice text from i18n, e.g. deputy.setting.user.<group>.<name>.choice.<choice>). When an array is passed, the key to be used for i18n is equal to the result of the allowed value's toString function.

When using allowedValues, as much as possible use primitive types as the deserialized type, since indexOf is used to check if a value is allowed, which may not work properly for class instances or objects.

defaultValue: DeserializedType

The default value of the setting.

Parse a serialized value into a deserialized one.

The raw value to parse.

The parsed value.

displayOptions?: DisplayOptions

Display options for this setting when showing up on settings interfaces.

isDisabled: ((config?: UserConfiguration) => string | boolean)

Type declaration

    • (config?): string | boolean
    • Parameters

      Returns string | boolean

      if this option is disabled or not.

isHidden: ((config?: UserConfiguration) => string | boolean)

Type declaration

    • (config?): string | boolean
    • Parameters

      Returns string | boolean

      if this option is hidden or not.

Serialize this setting's value or a given value.

The value to serialize

basicSerializers: {
    deserialize: ((value: any) => any);
    serialize: ((value: any) => any);
} = ...

Methods

  • Prevents the value of the setting from being changed. Used for debugging.

    Returns void

  • Sets the value and performs validation. If the input is an invalid value, and throwOnInvalid is false, the value will be reset to default.

    Parameters

    Returns void

  • Allows the value of the setting to be changed. Used for debugging.

    Returns void