You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.1 KiB
44 lines
1.1 KiB
12 years ago
|
'use strict';
|
||
12 years ago
|
define(
|
||
|
[
|
||
|
'app'
|
||
12 years ago
|
], function (App) {
|
||
|
return {
|
||
12 years ago
|
Events: {
|
||
|
ConfigUpdatedEvent: 'ConfigUpdatedEvent'
|
||
|
},
|
||
|
Keys : {
|
||
12 years ago
|
DefaultQualityProfileId: 'DefaultQualityProfileId',
|
||
|
DefaultRootFolderId: 'DefaultRootFolderId'
|
||
12 years ago
|
},
|
||
12 years ago
|
|
||
11 years ago
|
getValueBoolean: function (key, defaultValue) {
|
||
|
return this.getValue(key, defaultValue) === 'true';
|
||
|
},
|
||
|
|
||
11 years ago
|
getValue: function (key, defaultValue) {
|
||
12 years ago
|
|
||
12 years ago
|
var storeValue = localStorage.getItem(key);
|
||
12 years ago
|
|
||
12 years ago
|
if (!storeValue) {
|
||
|
return defaultValue;
|
||
|
}
|
||
12 years ago
|
|
||
12 years ago
|
return storeValue.toString();
|
||
|
},
|
||
12 years ago
|
|
||
11 years ago
|
setValue: function (key, value) {
|
||
12 years ago
|
|
||
12 years ago
|
console.log('Config: [{0}] => [{1}] '.format(key, value));
|
||
12 years ago
|
|
||
11 years ago
|
if (this.getValue(key) === value.toString()) {
|
||
12 years ago
|
return;
|
||
|
}
|
||
12 years ago
|
|
||
12 years ago
|
localStorage.setItem(key, value);
|
||
|
App.vent.trigger(this.Events.ConfigUpdatedEvent, {key: key, value: value});
|
||
12 years ago
|
|
||
12 years ago
|
}
|
||
|
};
|
||
12 years ago
|
});
|