lb.base.config

Configuration Adapter Module for Base Library

This is a generic data storage for configuration properties.  Options are stored as properties of a private config object.  They can be accessed using setOptions() to set one or several options, and getOption() to retrieve a single value.

Authors

Copyright

Eric Bréchemier © 2011-2013, Some Rights Reserved Legal-Box SAS © 2010-2011, All Rights Reserved

License

BSD License http://creativecommons.org/licenses/BSD/

Version

2013-09-10

Summary
lb.base.configConfiguration Adapter Module for Base Library
Functions
reset()Remove all options from configuration.
setOptions(options)Set one or several configuration options.
getOption(name, defaultValue)

Functions

reset()

Remove all options from configuration.

setOptions(options)

Set one or several configuration options.

Each new option is added to the configuration, replacing any existing value of the same name.  Options previously set are otherwise preserved.

In order to avoid clashes in the names of configuration properties, each property should use a prefix corresponding to the implementor of the module which makes use of it.  All configuration properties used in modules implemented by Legal-Box will use the prefix ‘lb’, e.g.  ‘lbFactory’ for the DOM Element Factory.

Parameter

optionsobject, a set of configuration properties

getOption(name, defaultValue)

Parameters

namestring, name of the configuration property to retrieve
defaultValueany, optional default value to return in case the configuration value is undefined or null.  The default value itself defaults to null.

Returns

  • the default value when the corresponding configuration property is missing, null or undefined
  • the value of the corresponding configuration property otherwise
Close