mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-06 15:42:32 -06:00
WebUI: prefer arrow functions whenever applicable
Compared to plain function, arrow function is simpler to understand (without bindings to `this`, `arguments`, `super`) and to read. Now, plain function will only be used when this object is required. PR #21691.
This commit is contained in:
@@ -37,14 +37,14 @@ window.qBittorrent.LocalPreferences ??= (() => {
|
||||
};
|
||||
|
||||
const LocalPreferencesClass = new Class({
|
||||
get: function(key, defaultValue) {
|
||||
get: (key, defaultValue) => {
|
||||
const value = localStorage.getItem(key);
|
||||
return ((value === null) && (defaultValue !== undefined))
|
||||
? defaultValue
|
||||
: value;
|
||||
},
|
||||
|
||||
set: function(key, value) {
|
||||
set: (key, value) => {
|
||||
try {
|
||||
localStorage.setItem(key, value);
|
||||
}
|
||||
@@ -53,7 +53,7 @@ window.qBittorrent.LocalPreferences ??= (() => {
|
||||
}
|
||||
},
|
||||
|
||||
remove: function(key) {
|
||||
remove: (key) => {
|
||||
try {
|
||||
localStorage.removeItem(key);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user