1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-14 15:03:42 +01:00
Radarr/UI/Config.js
2013-08-05 19:01:32 -07:00

41 lines
1.0 KiB
JavaScript

'use strict';
define(
[
'app'
], function (App) {
return {
Events: {
ConfigUpdatedEvent: 'ConfigUpdatedEvent'
},
Keys : {
DefaultQualityProfileId: 'DefaultQualityProfileId',
DefaultRootFolderId: 'DefaultRootFolderId'
},
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});
}
};
});