API for accessing and setting user settings. User settings are different from the application settings from _converse.api.settings because they are per-user and set via user action.
- Source:
Methods
(async, static) clear()
Clears all the user settings
- Source:
(async, static) clear()
Clears all the user settings
(static) get(key, fallbackopt) → {Promise}
Get the value of a particular user setting.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
key |
String | The setting name |
|
fallback |
* |
<optional> |
An optional fallback value if the user setting is undefined |
- Source:
Returns:
Promise which resolves with the value of the particular configuration setting.
- Type
- Promise
Example
_converse.api.user.settings.get("foo");
(static) get(key, fallbackopt) → {Promise}
Get the value of a particular user setting.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
key |
String | The setting name |
|
fallback |
* |
<optional> |
An optional fallback value if the user setting is undefined |
Returns:
Promise which resolves with the value of the particular configuration setting.
- Type
- Promise
Example
_converse.api.user.settings.get("foo");
(async, static) getModel() → {Promise.<Model>}
Returns the user settings model. Useful when you want to listen for change events.
- Source:
Returns:
- Type
- Promise.<Model>
Example
const settings = await _converse.api.user.settings.getModel();
(async, static) getModel() → {Promise.<Model>}
Returns the user settings model. Useful when you want to listen for change events.
Returns:
- Type
- Promise.<Model>
Example
const settings = await _converse.api.user.settings.getModel();
(async, static) set(settingsopt, keyopt, valueopt)
Set one or many user settings.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
settings |
Object |
<optional> |
An object containing configuration settings. |
key |
string |
<optional> |
Alternatively to passing in an object, you can pass in a key and a value. |
value |
string |
<optional> |
- Source:
Examples
_converse.api.user.settings.set("foo", "bar");
_converse.api.user.settings.set({
"foo": "bar",
"baz": "buz"
});
(async, static) set(settingsopt, keyopt, valueopt)
Set one or many user settings.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
settings |
Object |
<optional> |
An object containing configuration settings. |
key |
string |
<optional> |
Alternatively to passing in an object, you can pass in a key and a value. |
value |
string |
<optional> |
Examples
_converse.api.user.settings.set("foo", "bar");
_converse.api.user.settings.set({
"foo": "bar",
"baz": "buz"
});