mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-19 12:59:56 -07:00
WebUI: fetch cached info early
The cached info doesn't need to wait until the DOM is loaded. They can be fetched far earlier. PR #21830.
This commit is contained in:
parent
c9a55fce95
commit
ede08f3845
1 changed files with 10 additions and 5 deletions
|
@ -29,6 +29,7 @@ window.qBittorrent ??= {};
|
||||||
window.qBittorrent.Client ??= (() => {
|
window.qBittorrent.Client ??= (() => {
|
||||||
const exports = () => {
|
const exports = () => {
|
||||||
return {
|
return {
|
||||||
|
setup: setup,
|
||||||
closeWindow: closeWindow,
|
closeWindow: closeWindow,
|
||||||
closeFrameWindow: closeFrameWindow,
|
closeFrameWindow: closeFrameWindow,
|
||||||
getSyncMainDataInterval: getSyncMainDataInterval,
|
getSyncMainDataInterval: getSyncMainDataInterval,
|
||||||
|
@ -44,6 +45,13 @@ window.qBittorrent.Client ??= (() => {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const setup = () => {
|
||||||
|
// fetch various data and store it in memory
|
||||||
|
window.qBittorrent.Cache.buildInfo.init();
|
||||||
|
window.qBittorrent.Cache.preferences.init();
|
||||||
|
window.qBittorrent.Cache.qbtVersion.init();
|
||||||
|
};
|
||||||
|
|
||||||
const closeWindow = (windowID) => {
|
const closeWindow = (windowID) => {
|
||||||
const window = document.getElementById(windowID);
|
const window = document.getElementById(windowID);
|
||||||
if (!window)
|
if (!window)
|
||||||
|
@ -104,6 +112,8 @@ window.qBittorrent.Client ??= (() => {
|
||||||
})();
|
})();
|
||||||
Object.freeze(window.qBittorrent.Client);
|
Object.freeze(window.qBittorrent.Client);
|
||||||
|
|
||||||
|
window.qBittorrent.Client.setup();
|
||||||
|
|
||||||
// TODO: move global functions/variables into some namespace/scope
|
// TODO: move global functions/variables into some namespace/scope
|
||||||
|
|
||||||
this.torrentsTable = new window.qBittorrent.DynamicTable.TorrentsTable();
|
this.torrentsTable = new window.qBittorrent.DynamicTable.TorrentsTable();
|
||||||
|
@ -1755,11 +1765,6 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
window.addEventListener("load", () => {
|
window.addEventListener("load", () => {
|
||||||
// fetch various data and store it in memory
|
|
||||||
window.qBittorrent.Cache.buildInfo.init();
|
|
||||||
window.qBittorrent.Cache.preferences.init();
|
|
||||||
window.qBittorrent.Cache.qbtVersion.init();
|
|
||||||
|
|
||||||
// switch to previously used tab
|
// switch to previously used tab
|
||||||
const previouslyUsedTab = LocalPreferences.get("selected_window_tab", "transfers");
|
const previouslyUsedTab = LocalPreferences.get("selected_window_tab", "transfers");
|
||||||
switch (previouslyUsedTab) {
|
switch (previouslyUsedTab) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue