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/UI/Config.js

44 lines
1.1 KiB

'use strict';
12 years ago
define(
[
'app'
], function (App) {
return {
12 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) {
var storeValue = 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;
}
localStorage.setItem(key, value);
App.vent.trigger(this.Events.ConfigUpdatedEvent, {key: key, value: value});
}
};
12 years ago
});