v7.3.0

Config
internal

This class holds the description of a config property. Only one instance of this class is needed for each config name (e.g., "text"). If config options are supplied, however, they also contribute to the cached instance.

Instances should always be retrieved by calling Config.get().

The Configs of this class correspond to options that can be supplied to the get() method. These affect the behavior of the config property in some way, as descried by their respective documentation.

This class is not used directly.

The Setter

The primary functionality provided by Config is its standard setter. This setter function ensures consistent behavior when modifying config properties.

The standard setter algorithm is as follows (using the 'text' config for illustration):

  • If the class defines a changeText() method, call it passing the new value and the current value: changeText(newText, oldText).
    Then:
    • If changeText() exits without returning a value (i.e., undefined), exit and do nothing further. The assumption is that the changer method has done all that is required.
    • Otherwise, the return value of changeText() replaces the incoming value passed to the setter.
  • If the new value (or the value returned by changeText()) is !== to the current value:
    • Update the stored config value in this._text.
    • If the class defines an updateText() method, call it passing the new value and the previous value. updateText(newText, oldText)
    • Any return value from updateText() is stored in this.textUpdated.
    • If the class defines an onConfigChange() method, call it passing an object with the following properties:
      • name - The config's name
      • value - The new value
      • was - The previous value
      • config - The Config instance.

NOTE: unlike changeText() and updateText(), the name of the onConfigChange() method is unaffected by the config's name.

No results

Configs

Configs are options you supply in a configuration object when creating an instance of this class
  • date : Booleanfalse

    Indicates that values are Date objects.

  • nullify : Booleanfalse
    internal

    Indicates that this config property should automatically be set to null on destroy.

  • render : Booleanfalse
    internal

    Indicates that this config participates in rendering. This has does not affect the behavior of the property directly, but allows classes that perform rendering to detect which config changes will affect the rendered result.

Properties

Properties are getters/setters or publicly accessible variables on this class
  • descriptor : Object
    private
    READONLY

    The descriptor to use with Reflect.defineProperty() for defining this config's getter and setter.

  • initDescriptor : Object
    private
    READONLY

    The descriptor to use with Reflect.defineProperty() for defining this config's initter.

Functions

Functions are methods available for calling on the class

Source path

Core/Config.js

Contents