mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-06 21:02:28 +00:00
Merge branch 'unstable' into agents/daily/perf-agent-2026-02-15-3720994187998550610
This commit is contained in:
287 files changed
+243764
-7024
No files matched your search
@@ -143,17 +143,35 @@ export default class ExploreDataService {
|
||||
this.watchHistoryInterval = null;
|
||||
this.tagIdfInterval = null;
|
||||
this.unsubscribeHandlers = [];
|
||||
this.handleVisibility = this.handleVisibility.bind(this);
|
||||
}
|
||||
|
||||
initialize() {
|
||||
this.refreshWatchHistoryTagCounts({ force: true, reason: "init" });
|
||||
this.refreshTagIdf({ force: true, reason: "init" });
|
||||
this.subscribeToUpdates();
|
||||
if (typeof document !== "undefined") {
|
||||
document.addEventListener("visibilitychange", this.handleVisibility);
|
||||
}
|
||||
this.startIntervals();
|
||||
}
|
||||
|
||||
handleVisibility() {
|
||||
if (typeof document === "undefined") return;
|
||||
if (document.hidden) {
|
||||
this.clearIntervals();
|
||||
} else {
|
||||
this.startIntervals();
|
||||
}
|
||||
}
|
||||
|
||||
startIntervals() {
|
||||
this.clearIntervals();
|
||||
|
||||
if (typeof document !== "undefined" && document.hidden) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Number.isFinite(this.historyRefreshIntervalMs) && this.historyRefreshIntervalMs > 0) {
|
||||
this.watchHistoryInterval = setInterval(() => {
|
||||
if (typeof document !== "undefined" && document.hidden) {
|
||||
@@ -326,6 +344,9 @@ export default class ExploreDataService {
|
||||
|
||||
destroy() {
|
||||
this.clearIntervals();
|
||||
if (typeof document !== "undefined") {
|
||||
document.removeEventListener("visibilitychange", this.handleVisibility);
|
||||
}
|
||||
|
||||
if (this.watchHistoryRefreshHandle) {
|
||||
clearTimeout(this.watchHistoryRefreshHandle);
|
||||
|
||||
Reference in new issue
Block a user