mirror of
https://github.com/Radarr/Radarr
synced 2024-12-27 18:30:45 +00:00
39 lines
964 B
JavaScript
39 lines
964 B
JavaScript
'use strict';
|
|
define(
|
|
[
|
|
'app'
|
|
], function (App) {
|
|
return {
|
|
Events: {
|
|
ConfigUpdatedEvent: 'ConfigUpdatedEvent'
|
|
},
|
|
Keys : {
|
|
DefaultQualityProfileId: 'DefaultQualityProfileId'
|
|
},
|
|
|
|
GetValue: function (key, defaultValue) {
|
|
|
|
var storeValue = localStorage.getItem(key);
|
|
|
|
if (!storeValue) {
|
|
return defaultValue;
|
|
}
|
|
|
|
return storeValue.toString();
|
|
},
|
|
|
|
SetValue: function (key, value) {
|
|
|
|
console.log('Config: [{0}] => [{1}] '.format(key, value));
|
|
|
|
if (this.GetValue(key) === value.toString()) {
|
|
return;
|
|
}
|
|
|
|
localStorage.setItem(key, value);
|
|
App.vent.trigger(this.Events.ConfigUpdatedEvent, {key: key, value: value});
|
|
|
|
}
|
|
|
|
};
|
|
});
|