decord/beta/source/modules/messages/native/ChannelLatestMessageLoadingStatsManager.tsx
2026-10-01 14:13:23 +00:00

51 lines
2 KiB
TypeScript

// Module ID: 11035
// Function ID: 11036
// Name: ChannelLatestMessageLoadingStatsManager
// Dependencies: [1074, 6885, 2]
// Module 11035 (ChannelLatestMessageLoadingStatsManager)
import Constants from "Constants" /* 1074 */;
import Clickstream from "Clickstream" /* 6885 */;
import size from "module_2" /* 2 */;
const AnalyticEvents = Constants.AnalyticEvents;
class ChannelLatestMessageLoadingStatsManager {
constructor(label) {
const obj = Object.create(new.target.prototype);
obj.label = label;
return obj;
}
start(channelId) {
this.latestChannelMessagesLoad = { channelId: channelId.channelId, startMs: Date.now() };
({ channelId: channelId.channelId, startMs: Date.now() });
}
cancel() {
this.latestChannelMessagesLoad = undefined;
}
finish(channelId) {
const latestChannelMessagesLoad = this.latestChannelMessagesLoad;
if (null != latestChannelMessagesLoad) {
if (latestChannelMessagesLoad.channelId === channelId.channelId) {
const _Date = Date;
const seenChannelIds2 = ChannelLatestMessageLoadingStatsManager.seenChannelIds;
const diff = Date.now() - latestChannelMessagesLoad.startMs;
const hasItem = seenChannelIds2.has(channelId.channelId);
const tmp10 = ChannelLatestMessageLoadingStatsManager;
if (!hasItem) {
const seenChannelIds = tmp10.seenChannelIds;
seenChannelIds.add(channelId.channelId);
}
const obj2 = { load_duration_ms: diff, were_messages_cached: channelId.areMessagesCached, is_first_load: !hasItem };
const obj = Clickstream;
obj.trackClickstream(AnalyticEvents.CHANNEL_LATEST_MESSAGES_LOADED_CLICKSTREAM, obj2);
tmp.latestChannelMessagesLoad = undefined;
}
}
}
}
const prototype = ChannelLatestMessageLoadingStatsManager.prototype;
ChannelLatestMessageLoadingStatsManager.seenChannelIds = new Set();
new Set();
const result = size.fileFinishedImporting("modules/messages/native/ChannelLatestMessageLoadingStatsManager.tsx");
export default ChannelLatestMessageLoadingStatsManager;