1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

update variable declerations for appSettings and userSettings

This commit is contained in:
Cameron 2020-07-17 11:30:56 +01:00
parent f296eb3475
commit 0473e549ab
2 changed files with 14 additions and 14 deletions

View file

@ -28,7 +28,7 @@ import events from 'events';
}
export function enableAutomaticBitrateDetection(isInNetwork, mediaType, val) {
var key = 'enableautobitratebitrate-' + mediaType + '-' + isInNetwork;
const key = 'enableautobitratebitrate-' + mediaType + '-' + isInNetwork;
if (val !== undefined) {
if (isInNetwork && mediaType === 'Audio') {
val = true;
@ -45,7 +45,7 @@ import events from 'events';
}
export function maxStreamingBitrate(isInNetwork, mediaType, val) {
var key = 'maxbitrate-' + mediaType + '-' + isInNetwork;
const key = 'maxbitrate-' + mediaType + '-' + isInNetwork;
if (val !== undefined) {
if (isInNetwork && mediaType === 'Audio') {
// nothing to do, this is always a max value
@ -67,7 +67,7 @@ import events from 'events';
this.set('maxStaticMusicBitrate', val);
}
var defaultValue = 320000;
const defaultValue = 320000;
return parseInt(this.get('maxStaticMusicBitrate') || defaultValue.toString()) || defaultValue;
}
@ -118,7 +118,7 @@ import events from 'events';
}
export function set(name, value, userId) {
var currentValue = this.get(name, userId);
const currentValue = this.get(name, userId);
appStorage.setItem(getKey(name, userId), value);
if (currentValue !== value) {

View file

@ -2,7 +2,7 @@ import appSettings from 'appSettings';
import events from 'events';
function onSaveTimeout() {
var self = this;
const self = this;
self.saveTimeout = null;
self.currentApiClient.updateDisplayPreferences('usersettings', self.displayPrefs, self.currentUserId, 'emby');
}
@ -37,7 +37,7 @@ export class UserSettings {
return Promise.resolve();
}
var self = this;
const self = this;
return apiClient.getDisplayPreferences('usersettings', userId, 'emby').then(function (result) {
result.CustomPrefs = result.CustomPrefs || {};
@ -63,9 +63,9 @@ export class UserSettings {
* @param {boolean} enableOnServer - Flag to save preferences on server.
*/
set(name, value, enableOnServer) {
var userId = this.currentUserId;
var currentValue = this.get(name, enableOnServer);
var result = appSettings.set(name, value, userId);
const userId = this.currentUserId;
const currentValue = this.get(name, enableOnServer);
const result = appSettings.set(name, value, userId);
if (enableOnServer !== false && this.displayPrefs) {
this.displayPrefs.CustomPrefs[name] = value == null ? value : value.toString();
@ -86,7 +86,7 @@ export class UserSettings {
* @return {string} Value of setting.
*/
get(name, enableOnServer) {
var userId = this.currentUserId;
const userId = this.currentUserId;
if (enableOnServer !== false && this.displayPrefs) {
return this.displayPrefs.CustomPrefs[name];
}
@ -100,7 +100,7 @@ export class UserSettings {
* @return {Object|Promise} Configuration or Promise.
*/
serverConfig(config) {
var apiClient = this.currentApiClient;
const apiClient = this.currentApiClient;
if (config) {
return apiClient.updateUserConfiguration(this.currentUserId, config);
}
@ -349,7 +349,7 @@ export class UserSettings {
return this.set('libraryPageSize', parseInt(val, 10), false);
}
var libraryPageSize = parseInt(this.get('libraryPageSize', false), 10);
const libraryPageSize = parseInt(this.get('libraryPageSize', false), 10);
if (libraryPageSize === 0) {
// Explicitly return 0 to avoid returning 100 because 0 is falsy.
return 0;
@ -378,7 +378,7 @@ export class UserSettings {
* @return {Object} Query.
*/
loadQuerySettings(key, query) {
var values = this.get(key);
let values = this.get(key);
if (values) {
values = JSON.parse(values);
return Object.assign(query, values);
@ -393,7 +393,7 @@ export class UserSettings {
* @param {Object} query - Query.
*/
saveQuerySettings(key, query) {
var values = {};
const values = {};
if (query.SortBy) {
values.SortBy = query.SortBy;
}