1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00
Sonarr/UI/Config.js

41 lines
1.0 KiB
JavaScript
Raw Normal View History

2013-06-22 09:24:24 +03:00
'use strict';
2013-06-21 04:43:58 +03:00
define(
[
'app'
], function (App) {
return {
2013-06-21 04:43:58 +03:00
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});
}
2013-06-21 04:43:58 +03:00
};
2013-06-21 04:43:58 +03:00
});