decord/source/modules/quests/QuestHomeRoundtripTracker.tsx

98 lines
2.8 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 14588
// Function ID: 14589
2026-07-29 08:29:29 +00:00
// Name: clearTimeoutTimer
2026-08-24 06:08:38 +00:00
// Dependencies: [676, 698, 5011, 5016, 10540, 2]
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
// Module 14588 (clearTimeoutTimer)
import set from "set" /* 2 */;
import ME from "ME" /* 676 */;
import expandEventPropertiesDefault from "expandEventProperties" /* 698 */;
import setDefault from "set" /* 5011 */;
import set2 from "set" /* 5016 */;
import _modDef10540 from "module_10540" /* 10540 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
const AnalyticEvents = ME.AnalyticEvents;
2026-07-29 08:29:29 +00:00
let c4 = 30000;
class QuestHomeRoundtripTracker {
}
const prototype = QuestHomeRoundtripTracker.prototype;
prototype["clearTimeoutTimer"] = function clearTimeoutTimer() {
const self = this;
if (null != this.timeoutTimer) {
const _clearTimeout = clearTimeout;
clearTimeout(self.timeoutTimer);
self.timeoutTimer = null;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
};
prototype["sendMetric"] = function sendMetric(timeout, duration) {
2026-08-24 06:08:38 +00:00
let obj = expandEventPropertiesDefault;
2026-07-29 08:29:29 +00:00
obj = { timeout, duration };
obj.track(AnalyticEvents.QUEST_HOME_ROUNDTRIP, obj);
if (Math.random() <= 0.1) {
obj = { name: null, tags: null };
2026-08-24 06:08:38 +00:00
obj[0] = set2.MetricEvents.QUEST_HOME_ROUNDTRIP;
2026-07-29 08:29:29 +00:00
const _HermesInternal = HermesInternal;
const items = ["includes_bounties:" + arg2, ];
const _HermesInternal2 = HermesInternal;
items[1] = "timeout:" + timeout;
obj[1] = items;
2026-08-24 06:08:38 +00:00
setDefault.distribution(obj, duration);
const tmpResult = setDefault;
2026-07-29 08:29:29 +00:00
}
};
prototype["startTracking"] = function startTracking() {
let self = this;
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()) {
2026-07-20 16:05:17 +00:00
self.clearTracking();
2026-07-29 08:29:29 +00:00
} else {
if (flag2) {
let rounded = c4;
} else {
const _Math = Math;
const _performance = performance;
rounded = Math.round(performance.now() - self.startTime);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const _Math2 = Math;
self.sendMetric(flag2, Math.min(rounded, c4), flag);
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
obj2 = _modDef10540;
2026-07-29 08:29:29 +00:00
}
};
prototype["clearTracking"] = function clearTracking() {
this.clearTimeoutTimer();
this.startTime = null;
};
2026-08-24 06:08:38 +00:00
const result = set.fileFinishedImporting("modules/quests/QuestHomeRoundtripTracker.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default Object.create(QuestHomeRoundtripTracker.prototype);