Settings
The Settings module provides an API which can be used to store and retrieve system wide settings.
In general, when storing a setting with the Settings module, it is a good idea to organize settings in namespaces to avoid potential conflicts. All the system settings are stored under the Device namespace.
To store a new setting, call setValue("SomeNamespace.SomeSetting", "settingValue"). Keep in mind that, when storing a setting, the value should be in String format. To retrieve a setting, call getValue("SomeNamespace.SomeSetting").
Methods
getValue(key)
Retreives the setting value of the provided key.
Parameters:
| Name | Type | Description |
|---|---|---|
key | String | The key of the setting to retrieve. |
Returns:
| Type | Description |
|---|---|
| A promise. | The listener will be passed the following arguments: - value: The setting value mapped to the provided key. |
setValue(key, value)
Stores a setting and maps it to the provided key.
Parameters:
| Name | Type | Description |
|---|---|---|
key | String | The key of the setting to store. |
value | String | The setting value to store. |
Returns:
| Type | Description |
|---|---|
| A promise. | No arguments are passed to the completion handler. |