Class: Config

Config

A class for storing configuration data. It does not define any attribute. A Config object, however, yields a (readonly) result for every attribute name you pass to it. In all cases the result is a Config object, which is initialized by the appropriate subobject of p_config. By default Config.EMPTY is returned.

new Config(p_config, p_environment)

Parameters:
Name Type Description
p_config object A configuration template object (a JSON object!). As a template object it may contain @-values that are replaced by concrete values by means of the function module:wk/config/concretize.
p_environment object An environment object that is used for computing a concrete value. It should contain concrete values for @-values that are referenced by p_config. For example:
{ '@width':  500,
  '@height': 400
}
Source:

Members


<static> EMPTY :Config

An empty config Object which can be used as a default value.
Type:
Source:

Methods


config()

The original configuration object
Source:
Returns:
Type
Object

default(p_default)

Sets default values for JSON attributes which are not found in the configuration object itself.
Parameters:
Name Type Description
p_default object
Source:

environment()

The environment to be used for this.config. As all sub objects of a configuration object share the same environment, it suffices to change the content of the environment one of those objects to change the environment of all related config objects.
Source:
Returns:
Type
Object

isDefined()

Returns true, if this.config has been defined.
Source:
Returns:
Type
Boolean

isUndefined()

Returns true, if this.config has not been defined.
Source:
Returns:
Type
Boolean

value(p_config)

Parameters:
Name Type Description
p_config Object
Properties
Name Type Argument Default Description
environment Object <optional>
this.environment()
specials Array.<String> <nullable>
level number <nullable>
Source:
Returns:
The concretized value of this.config()
Type
Object