mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-23 06:45:19 -07:00
Update localstorage key prefixes
This commit is contained in:
parent
266f28883a
commit
f38430d632
1 changed files with 10 additions and 10 deletions
|
@ -2,7 +2,7 @@ var $ = require('jquery');
|
||||||
var vent = require('./vent');
|
var vent = require('./vent');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
ConfigNamespace : 'Radarr',
|
ConfigNamespace : 'Radarr.',
|
||||||
|
|
||||||
Events : {
|
Events : {
|
||||||
ConfigUpdatedEvent : 'ConfigUpdatedEvent'
|
ConfigUpdatedEvent : 'ConfigUpdatedEvent'
|
||||||
|
@ -18,10 +18,10 @@ module.exports = {
|
||||||
},
|
},
|
||||||
|
|
||||||
getValueJson : function (key, defaultValue) {
|
getValueJson : function (key, defaultValue) {
|
||||||
key = this.ConfigNamespace + key;
|
var storeKey = this.ConfigNamespace + key;
|
||||||
defaultValue = defaultValue || {};
|
defaultValue = defaultValue || {};
|
||||||
|
|
||||||
var storeValue = window.localStorage.getItem(key);
|
var storeValue = window.localStorage.getItem(storeKey);
|
||||||
|
|
||||||
if (!storeValue) {
|
if (!storeValue) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
|
@ -37,8 +37,8 @@ module.exports = {
|
||||||
},
|
},
|
||||||
|
|
||||||
getValue : function(key, defaultValue) {
|
getValue : function(key, defaultValue) {
|
||||||
key = this.ConfigNamespace + key;
|
var storeKey = this.ConfigNamespace + key;
|
||||||
var storeValue = window.localStorage.getItem(key);
|
var storeValue = window.localStorage.getItem(storeKey);
|
||||||
|
|
||||||
if (!storeValue) {
|
if (!storeValue) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
|
@ -52,22 +52,22 @@ module.exports = {
|
||||||
},
|
},
|
||||||
|
|
||||||
setValue : function(key, value) {
|
setValue : function(key, value) {
|
||||||
key = this.ConfigNamespace + key;
|
var storeKey = this.ConfigNamespace + key;
|
||||||
console.log('Config: [{0}] => [{1}]'.format(key, value));
|
console.log('Config: [{0}] => [{1}]'.format(storeKey, value));
|
||||||
|
|
||||||
if (this.getValue(key) === value.toString()) {
|
if (this.getValue(storeKey) === value.toString()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
window.localStorage.setItem(key, value);
|
window.localStorage.setItem(storeKey, value);
|
||||||
vent.trigger(this.Events.ConfigUpdatedEvent, {
|
vent.trigger(this.Events.ConfigUpdatedEvent, {
|
||||||
key : key,
|
key : key,
|
||||||
value : value
|
value : value
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
console.error('Unable to save config: [{0}] => [{1}]'.format(key, value));
|
console.error('Unable to save config: [{0}] => [{1}]'.format(storeKey, value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue