Class: Config

Config

Type safe config class The config class is basically a fancy dictionary. The difference between it and a dictionary is that it consults a template object when setting and getting a value. - When setting a value it makes sure that you are giving a name of a parameter that exists in the template and that the value that you gave to the parameter is correctly converted to the type expected. - When getting a value it makes sure you use the right name for the key. The idea is that the user will not be able to accidently put config options which are not used and will only be able to supply the right types. In addition, some config options will have to be supplied by the user (div id where to create some HTML elements is an example of this). Config will also supply a method by which config options by the user will override anything in the default config. This class should not be a singleton since the user may want to put two boards on the page and have each configured differently.

Constructor

new Config()

Author:
  • mark.veltzer@gmail.com (Mark Veltzer)
Source:

Methods

check()

check that the config is good to go for instance: check that all required arguments are set
This:
Author:
  • mark.veltzer@gmail.com (Mark Veltzer)
Source:

getValue(key) → {anything}

get a value for a key.
This:
Parameters:
Name Type Description
key anything key to store in the config.
Author:
  • mark.veltzer@gmail.com (Mark Veltzer)
Source:
Returns:
the value associated with the key.
Type
anything

initialize(tmpl) → {Config}

creates a new instance.
This:
Parameters:
Name Type Description
tmpl object template to use.
Author:
  • mark.veltzer@gmail.com (Mark Veltzer)
Source:
Returns:
new instance.
Type
Config

override(d)

set many values at once
This:
Parameters:
Name Type Description
d object dictionary of values.
Author:
  • mark.veltzer@gmail.com (Mark Veltzer)
Source:

setValue(key, value)

set a key to a certain value in the current configuration
This:
Parameters:
Name Type Description
key anything key to store in the config.
value anything value to store in the config.
Author:
  • mark.veltzer@gmail.com (Mark Veltzer)
Source: