mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-21 16:55:46 +03: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 ??= (() => {
|
||||
const exports = () => {
|
||||
return {
|
||||
setup: setup,
|
||||
closeWindow: closeWindow,
|
||||
closeFrameWindow: closeFrameWindow,
|
||||
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 window = document.getElementById(windowID);
|
||||
if (!window)
|
||||
|
@ -104,6 +112,8 @@ window.qBittorrent.Client ??= (() => {
|
|||
})();
|
||||
Object.freeze(window.qBittorrent.Client);
|
||||
|
||||
window.qBittorrent.Client.setup();
|
||||
|
||||
// TODO: move global functions/variables into some namespace/scope
|
||||
|
||||
this.torrentsTable = new window.qBittorrent.DynamicTable.TorrentsTable();
|
||||
|
@ -1755,11 +1765,6 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||
});
|
||||
|
||||
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
|
||||
const previouslyUsedTab = LocalPreferences.get("selected_window_tab", "transfers");
|
||||
switch (previouslyUsedTab) {
|
||||
|
|
Loading…
Reference in a new issue