ConfigurationManager

How to get ConfigurationManager

ES2015+:

import ConfigurationManager from 'fontoxml-configuration/configurationManager'

ES5:

define([
	'fontoxml-configuration/configurationManager'
], function (
	ConfigurationManager
) {
});

Type: Class

Provides a mechanism for asynchronously providing configuration and other injectables to components that require them, without causing dependency ordering issues.

One configuration option is always defined: scope. This can be included by including fontoxml-configuration/get!scope. The value of this configuration option is the value of the scope object in the URL.

Methods

Name Description
fontoxml-configuration/get

Get a configuration value

Use an import such as fontoxml-configuration/get!some-configuration-value to obtain the value passed to ConfigurationManager#set for the same name.

Be careful not to create a cyclic dependency by requesting configuration values in (indirect) dependencies of configuration.js. The easiest way to prevent these dependencies is by not depending on any managers or platform code in the configuration.js files. While depending on some managers may work at this moment in time, they may start to depend on configuration in the future.

set

Set a configuration value


  Arguments
# Name Type Description
1. key String
2. promiseOrValue Promise<any> | any
setDefault

Set the default value for a configuration value.

The default value is used if no value is specified for the same key in config/configuration.js. If a package attempts to get a configuration value without a default value set, an error will be thrown.

This should only be called in the setDefaultConfiguration.js for the package defining the configuration value.


  Arguments
# Name Type Description
1. key String
2. promiseOrValue Promise | any