jellyfish-web/src/components/syncPlay/core/Settings.js

29 lines
739 B
JavaScript
Raw Normal View History

2020-10-14 20:40:46 +01:00
/**
* Module that manages SyncPlay settings.
* @module components/syncPlay/core/Settings
*/
2021-09-03 01:09:11 -04:00
import appSettings from '../../../scripts/settings/appSettings';
2020-10-14 20:40:46 +01:00
/**
2021-09-03 01:09:11 -04:00
* Prefix used when saving SyncPlay settings.
2020-10-14 20:40:46 +01:00
*/
2021-09-03 01:09:11 -04:00
const PREFIX = 'syncPlay';
2020-10-14 20:40:46 +01:00
2021-09-03 01:09:11 -04:00
/**
* Gets the value of a setting.
* @param {string} name The name of the setting.
* @returns {string} The value.
*/
export function getSetting(name) {
return appSettings.get(name, PREFIX);
2020-10-14 20:40:46 +01:00
}
2021-09-03 01:09:11 -04:00
/**
* Sets the value of a setting. Triggers an update if the new value differs from the old one.
* @param {string} name The name of the setting.
* @param {Object} value The value of the setting.
*/
export function setSetting(name, value) {
return appSettings.set(name, value, PREFIX);
}