You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Lidarr/src/UI/Config.js

46 lines
1.3 KiB

'use strict';
12 years ago
define(
[
'vent'
], function (vent) {
return {
12 years ago
Events: {
ConfigUpdatedEvent: 'ConfigUpdatedEvent'
},
Keys : {
DefaultQualityProfileId: 'DefaultQualityProfileId',
DefaultRootFolderId: 'DefaultRootFolderId',
UseSeasonFolder: 'UseSeasonFolder'
},
getValueBoolean: function (key, defaultValue) {
defaultValue = defaultValue || false;
return this.getValue(key, defaultValue.toString()) === 'true';
},
11 years ago
getValue: function (key, defaultValue) {
11 years ago
var storeValue = window.localStorage.getItem(key);
if (!storeValue) {
return defaultValue;
}
return storeValue.toString();
},
11 years ago
setValue: function (key, value) {
console.log('Config: [{0}] => [{1}] '.format(key, value));
11 years ago
if (this.getValue(key) === value.toString()) {
return;
}
11 years ago
window.localStorage.setItem(key, value);
vent.trigger(this.Events.ConfigUpdatedEvent, {key: key, value: value});
}
};
12 years ago
});