Configuration
ActiveJS tries to give as many configuration options as possible to allow some degree of customization and personalization. While not requiring any configuration by choosing the most sensible defaults.
Configuration can be done on many levels, it can be done per instance and it can also be done globally.
Inline / per-instance configuration
Global configuration
ActiveJS exposes a global class called Configuration, through which you can set and reset global config that overrides default configuration. Which can still be overridden by inline config.
To set the global config you can use the set
method, it accepts a configuration object of type GlobalConfig.
Hierarchy of configuration
The more specific a configuration the higher precedence it has.
Given the global config type interface GlobalConfig. This is how the precedence order works, going from lowest to highest precedence.
Notes
In a Single Page App, you should set global configuration only once, and override it in the inline config if needed. Otherwise, it can become very difficult to keep track of which instances are using what configuration, depending on their time of creation.
If you do need to change global configuration multiple times, just keep in mind that calling
Configuration.set
second time doesn't merge the new configuration with the old one it simply rewrites it. However, the defaults are not affected by this behavior, they have to be overridden specifically every time.
Last updated