mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-26 19:20:32 +00:00
WebUI: Use modern class syntax to create LocalPreferences class
Some checks are pending
CI - File health / Check (push) Waiting to run
CI - macOS / Build (1.2.19, GUI=OFF, 6.7.0) (push) Waiting to run
CI - macOS / Build (1.2.19, GUI=ON, 6.7.0) (push) Waiting to run
CI - macOS / Build (2.0.10, GUI=OFF, 6.7.0) (push) Waiting to run
CI - macOS / Build (2.0.10, GUI=ON, 6.7.0) (push) Waiting to run
CI - Python / Check (push) Waiting to run
CI - Ubuntu / Build (1.2.19, GUI=OFF, 6.5.2) (push) Waiting to run
CI - Ubuntu / Build (1.2.19, GUI=ON, 6.5.2) (push) Waiting to run
CI - Ubuntu / Build (2.0.10, GUI=OFF, 6.5.2) (push) Waiting to run
CI - Ubuntu / Build (2.0.10, GUI=ON, 6.5.2) (push) Waiting to run
CI - WebUI / Check (push) Waiting to run
CI - Windows / Build (1.2.19) (push) Waiting to run
CI - Windows / Build (2.0.10) (push) Waiting to run
Some checks are pending
CI - File health / Check (push) Waiting to run
CI - macOS / Build (1.2.19, GUI=OFF, 6.7.0) (push) Waiting to run
CI - macOS / Build (1.2.19, GUI=ON, 6.7.0) (push) Waiting to run
CI - macOS / Build (2.0.10, GUI=OFF, 6.7.0) (push) Waiting to run
CI - macOS / Build (2.0.10, GUI=ON, 6.7.0) (push) Waiting to run
CI - Python / Check (push) Waiting to run
CI - Ubuntu / Build (1.2.19, GUI=OFF, 6.5.2) (push) Waiting to run
CI - Ubuntu / Build (1.2.19, GUI=ON, 6.5.2) (push) Waiting to run
CI - Ubuntu / Build (2.0.10, GUI=OFF, 6.5.2) (push) Waiting to run
CI - Ubuntu / Build (2.0.10, GUI=ON, 6.5.2) (push) Waiting to run
CI - WebUI / Check (push) Waiting to run
CI - Windows / Build (1.2.19) (push) Waiting to run
CI - Windows / Build (2.0.10) (push) Waiting to run
LocalPreferences class is now created using modern class syntax (minimal changes to remove Mootools bits). In addition, I removed redundant suffix from class name. PR #21780.
This commit is contained in:
parent
71f83cf9ba
commit
3ec645674a
@ -32,28 +32,28 @@ window.qBittorrent ??= {};
|
||||
window.qBittorrent.LocalPreferences ??= (() => {
|
||||
const exports = () => {
|
||||
return {
|
||||
LocalPreferencesClass: LocalPreferencesClass
|
||||
LocalPreferences: LocalPreferences
|
||||
};
|
||||
};
|
||||
|
||||
const LocalPreferencesClass = new Class({
|
||||
get: (key, defaultValue) => {
|
||||
class LocalPreferences {
|
||||
get(key, defaultValue) {
|
||||
const value = localStorage.getItem(key);
|
||||
return ((value === null) && (defaultValue !== undefined))
|
||||
? defaultValue
|
||||
: value;
|
||||
},
|
||||
}
|
||||
|
||||
set: (key, value) => {
|
||||
set(key, value) {
|
||||
try {
|
||||
localStorage.setItem(key, value);
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
remove: (key) => {
|
||||
remove(key) {
|
||||
try {
|
||||
localStorage.removeItem(key);
|
||||
}
|
||||
@ -61,7 +61,7 @@ window.qBittorrent.LocalPreferences ??= (() => {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return exports();
|
||||
})();
|
||||
|
@ -99,7 +99,7 @@ window.qBittorrent.Dialog ??= (() => {
|
||||
})();
|
||||
Object.freeze(window.qBittorrent.Dialog);
|
||||
|
||||
const LocalPreferences = new window.qBittorrent.LocalPreferences.LocalPreferencesClass();
|
||||
const LocalPreferences = new window.qBittorrent.LocalPreferences.LocalPreferences();
|
||||
|
||||
let saveWindowSize = () => {};
|
||||
let loadWindowWidth = () => {};
|
||||
|
Loading…
Reference in New Issue
Block a user