Files
discord-decomp/modules/messages/native/ChannelLatestMessageLoadingStatsManager.tsx
T
2026-11-01 12:12:55 +02:00

37 lines
1.3 KiB
TypeScript

// Metro module 10902 (f10903).
import { AnalyticEvents } from "../../../Constants";
import { trackClickstream } from "../../app_analytics/clickstream/Clickstream";
class ChannelLatestMessageLoadingStatsManager {
static seenChannelIds = new Set();
constructor(a0) {
this.label = a0;
}
start(a0) {
this.latestChannelMessagesLoad = {
channelId: a0.channelId,
startMs: Date.now()
};
}
cancel() {
this.latestChannelMessagesLoad = void 0;
}
finish(a0) {
const latestChannelMessagesLoad = this.latestChannelMessagesLoad;
if (latestChannelMessagesLoad != null && latestChannelMessagesLoad.channelId === a0.channelId) {
const load_duration_ms = Date.now() - latestChannelMessagesLoad.startMs;
const r18 = ChannelLatestMessageLoadingStatsManager.seenChannelIds.has(a0.channelId);
const is_first_load = !r18;
if (!r18) {
ChannelLatestMessageLoadingStatsManager.seenChannelIds.add(a0.channelId);
}
trackClickstream(AnalyticEvents.CHANNEL_LATEST_MESSAGES_LOADED_CLICKSTREAM, {
load_duration_ms,
were_messages_cached: a0.areMessagesCached,
is_first_load
});
this.latestChannelMessagesLoad = void 0;
}
}
}
export default ChannelLatestMessageLoadingStatsManager;