decord/source/modules/quests/QuestBarRenderDelayTracker.tsx
github-actions 777dc50a28 chore: update source for alpha 346.3
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4790.js (118.4 MB)
2026-09-10 19:12:31 +00:00

85 lines
2.8 KiB
TypeScript

// Module ID: 11371
// Function ID: 11372
// Name: QuestBarRenderDelayTracker
// Dependencies: [1074, 7653, 7658, 1242, 11372, 2]
// Module 11371 (QuestBarRenderDelayTracker)
import Constants from "Constants" /* 1074 */;
import AnalyticsUtilsDefault from "AnalyticsUtils" /* 1242 */;
import MonitoringAgentDefault from "MonitoringAgent" /* 7653 */;
import MetricEvents from "MetricEvents" /* 7658 */;
import DiscordAppStateDefault from "DiscordAppState" /* 11372 */;
import size from "module_2" /* 2 */;
const AnalyticEvents = Constants.AnalyticEvents;
let c4 = 30000;
class QuestBarRenderDelayTracker {
constructor() {
return Object.assign({ startTime: null, questId: null, timeoutTimer: null });
}
}
const prototype = QuestBarRenderDelayTracker.prototype;
prototype["clearTimeoutTimer"] = function clearTimeoutTimer() {
const self = this;
if (null != this.timeoutTimer) {
const _clearTimeout = clearTimeout;
clearTimeout(self.timeoutTimer);
self.timeoutTimer = null;
}
};
prototype["sendMetric"] = function sendMetric(quest_id, timeout, duration) {
if (Math.random() <= 0.1) {
const obj2 = { name: MetricEvents.MetricEvents.QUEST_BAR_RENDER_DELAY, tags: null };
const _HermesInternal = HermesInternal;
const items = ["quest_id:" + quest_id, ];
const _HermesInternal2 = HermesInternal;
items[1] = "timeout:" + timeout;
obj2.tags = items;
MonitoringAgentDefault.distribution(obj2, duration);
const obj4 = { quest_id, timeout, duration };
AnalyticsUtilsDefault.track(AnalyticEvents.QUEST_BAR_RENDER_DELAY, obj4);
}
};
prototype["startTracking"] = function startTracking(questId) {
const self = this;
closure_0 = questId;
this.clearTracking();
this.startTime = performance.now();
this.questId = questId;
this.timeoutTimer = setTimeout(() => {
self.stopTracking(closure_0, true);
}, c4);
};
prototype["stopTracking"] = function stopTracking(arg0) {
let flag = arg1;
if (arg1 === undefined) {
flag = false;
}
const self = this;
if (null !== this.startTime) {
if (self.questId === arg0) {
if ("active" !== obj.getState()) {
self.clearTracking();
} else {
if (flag) {
let rounded = c4;
} else {
const _Math = Math;
const _performance = performance;
rounded = Math.round(performance.now() - self.startTime);
}
const _Math2 = Math;
self.sendMetric(arg0, flag, Math.min(rounded, c4));
}
obj = DiscordAppStateDefault;
}
}
};
prototype["clearTracking"] = function clearTracking() {
this.clearTimeoutTimer();
this.startTime = null;
this.questId = null;
};
const result = size.fileFinishedImporting("modules/quests/QuestBarRenderDelayTracker.tsx");
export default Object.assign({ startTime: null, questId: null, timeoutTimer: null });