decord/beta/source/modules/messages/native/ChannelLatestMessageLoadingStatsManager.tsx

52 lines
2 KiB
TypeScript
Raw Normal View History

2026-10-07 22:43:51 +00:00
// Module ID: 11157
// Function ID: 11158
// Name: ChannelLatestMessageLoadingStatsManager
2026-10-07 22:43:51 +00:00
// Dependencies: [1085, 6974, 2]
2026-10-07 22:43:51 +00:00
// Module 11157 (ChannelLatestMessageLoadingStatsManager)
import Constants from "Constants" /* 1085 */;
import Clickstream from "Clickstream" /* 6974 */;
import size from "module_2" /* 2 */;
const AnalyticEvents = Constants.AnalyticEvents;
class ChannelLatestMessageLoadingStatsManager {
2026-10-01 14:13:23 +00:00
constructor(label) {
const obj = Object.create(new.target.prototype);
obj.label = label;
return obj;
}
2026-10-01 14:13:23 +00:00
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;
}
}
}
2026-10-01 14:13:23 +00:00
}
const prototype = ChannelLatestMessageLoadingStatsManager.prototype;
ChannelLatestMessageLoadingStatsManager.seenChannelIds = new Set();
2026-10-01 14:13:23 +00:00
new Set();
const result = size.fileFinishedImporting("modules/messages/native/ChannelLatestMessageLoadingStatsManager.tsx");
export default ChannelLatestMessageLoadingStatsManager;