decord/beta/source/modules/quests/QuestHomeRoundtripTracker.tsx
github-actions 9b6fea255e chore: update source for beta 346.12
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4821.js (118.4 MB)
2026-09-18 19:45:33 +00:00

96 lines
2.9 KiB
TypeScript

// Module ID: 15250
// Function ID: 15251
// Name: QuestHomeRoundtripTracker
// Dependencies: [1074, 1240, 7704, 7709, 11437, 2]
// Module 15250 (QuestHomeRoundtripTracker)
import Constants from "Constants" /* 1074 */;
import AnalyticsUtilsDefault from "AnalyticsUtils" /* 1240 */;
import MonitoringAgentDefault from "MonitoringAgent" /* 7704 */;
import MetricEvents from "MetricEvents" /* 7709 */;
import DiscordAppStateDefault from "DiscordAppState" /* 11437 */;
import size from "module_2" /* 2 */;
const AnalyticEvents = Constants.AnalyticEvents;
let c4 = 30000;
class QuestHomeRoundtripTracker {
constructor() {
return Object.assign({ startTime: null, timeoutTimer: null });
}
}
const prototype = QuestHomeRoundtripTracker.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(timeout, duration, arg2) {
AnalyticsUtilsDefault.track(AnalyticEvents.QUEST_HOME_ROUNDTRIP, { timeout, duration });
if (Math.random() <= 0.1) {
const obj3 = { name: MetricEvents.MetricEvents.QUEST_HOME_ROUNDTRIP, tags: null };
const _HermesInternal = HermesInternal;
const items = ["includes_bounties:" + arg2, ];
const _HermesInternal2 = HermesInternal;
items[1] = "timeout:" + timeout;
obj3.tags = items;
MonitoringAgentDefault.distribution(obj3, duration);
const tmpResult = MonitoringAgentDefault;
}
};
prototype["startTracking"] = function startTracking() {
const self = this;
let obj = arg0;
if (arg0 === undefined) {
obj = {};
}
let flag = obj.includesBounties;
if (flag === undefined) {
flag = false;
}
self.clearTracking();
self.startTime = performance.now();
self.timeoutTimer = setTimeout(() => {
self.stopTracking({ includesBounties: flag, timeout: true });
}, c4);
};
prototype["stopTracking"] = function stopTracking() {
let obj = arg0;
if (arg0 === undefined) {
obj = {};
}
let flag = obj.includesBounties;
if (flag === undefined) {
flag = false;
}
let flag2 = obj.timeout;
if (flag2 === undefined) {
flag2 = false;
}
const self = this;
if (null != this.startTime) {
if ("active" !== obj2.getState()) {
self.clearTracking();
} else {
if (flag2) {
let rounded = c4;
} else {
const _Math = Math;
const _performance = performance;
rounded = Math.round(performance.now() - self.startTime);
}
const _Math2 = Math;
self.sendMetric(flag2, Math.min(rounded, c4), flag);
}
obj2 = DiscordAppStateDefault;
}
};
prototype["clearTracking"] = function clearTracking() {
this.clearTimeoutTimer();
this.startTime = null;
};
const result = size.fileFinishedImporting("modules/quests/QuestHomeRoundtripTracker.tsx");
export default Object.assign({ startTime: null, timeoutTimer: null });