mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-06 21:21:24 -07:00
WebUI: implement debounce behavior for resize events
This commit is contained in:
parent
0c580c3174
commit
29379232aa
6 changed files with 43 additions and 31 deletions
|
@ -119,14 +119,9 @@ window.qBittorrent.DynamicTable ??= (() => {
|
|||
}
|
||||
};
|
||||
|
||||
this.resizeDebounceTimer = -1;
|
||||
const resizeDebouncer = (entries) => {
|
||||
clearTimeout(this.resizeDebounceTimer);
|
||||
this.resizeDebounceTimer = setTimeout(() => {
|
||||
resizeFn(entries);
|
||||
this.resizeDebounceTimer = -1;
|
||||
}, 100);
|
||||
};
|
||||
const resizeDebouncer = window.qBittorrent.Misc.createDebounceHandler(100, (entries) => {
|
||||
resizeFn(entries);
|
||||
});
|
||||
|
||||
const resizeObserver = new ResizeObserver(resizeDebouncer);
|
||||
resizeObserver.observe(parentPanel, { box: "border-box" });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue