1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-12 22:12:38 +01:00
Radarr/UI/Config.js

41 lines
1.0 KiB
JavaScript
Raw Normal View History

2013-06-22 08:24:24 +02:00
'use strict';
2013-06-21 03:43:58 +02:00
define(
[
'app'
], function (App) {
return {
2013-06-21 03:43:58 +02:00
Events: {
ConfigUpdatedEvent: 'ConfigUpdatedEvent'
},
Keys : {
DefaultQualityProfileId: 'DefaultQualityProfileId',
DefaultRootFolderId: 'DefaultRootFolderId'
},
2013-08-04 03:27:12 +02:00
getValue: function (key, defaultValue) {
var storeValue = localStorage.getItem(key);
if (!storeValue) {
return defaultValue;
}
return storeValue.toString();
},
2013-08-04 03:27:12 +02:00
setValue: function (key, value) {
console.log('Config: [{0}] => [{1}] '.format(key, value));
2013-08-04 03:27:12 +02:00
if (this.getValue(key) === value.toString()) {
return;
}
localStorage.setItem(key, value);
App.vent.trigger(this.Events.ConfigUpdatedEvent, {key: key, value: value});
}
2013-06-21 03:43:58 +02:00
};
2013-06-21 03:43:58 +02:00
});