mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-12 08:07:10 -07:00
Moved source code under src folder - massive change
This commit is contained in:
parent
2fc8123d6b
commit
5bf0e197ec
1499 changed files with 1054 additions and 1444 deletions
43
src/UI/Config.js
Normal file
43
src/UI/Config.js
Normal file
|
@ -0,0 +1,43 @@
|
|||
'use strict';
|
||||
define(
|
||||
[
|
||||
'app'
|
||||
], function (App) {
|
||||
return {
|
||||
Events: {
|
||||
ConfigUpdatedEvent: 'ConfigUpdatedEvent'
|
||||
},
|
||||
Keys : {
|
||||
DefaultQualityProfileId: 'DefaultQualityProfileId',
|
||||
DefaultRootFolderId: 'DefaultRootFolderId'
|
||||
},
|
||||
|
||||
getValueBoolean: function (key, defaultValue) {
|
||||
return this.getValue(key, defaultValue) === 'true';
|
||||
},
|
||||
|
||||
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});
|
||||
|
||||
}
|
||||
};
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue