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

43 lines
1.2 KiB

'use strict';
11 years ago
define(
[
'vent'
], function (vent) {
return {
11 years ago
Events: {
ConfigUpdatedEvent: 'ConfigUpdatedEvent'
},
Keys : {
DefaultQualityProfileId: 'DefaultQualityProfileId',
DefaultRootFolderId: 'DefaultRootFolderId'
},
getValueBoolean: function (key, defaultValue) {
return this.getValue(key, defaultValue) === '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});
}
};
11 years ago
});