decord/source/modules/messages/useOnMessageSend.tsx

53 lines
1.7 KiB
TypeScript
Raw Normal View History

// Module ID: 16963
// Function ID: 16964
2026-07-20 16:05:17 +00:00
// Name: useOnMessageSend
// Dependencies: [19, 1074, 573, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
// Module 16963 (useOnMessageSend)
import DispatcherDefault from "Dispatcher" /* 573 */;
import noop from "module_19" /* 19 */;
2026-07-23 10:11:24 +00:00
const MessageStates = fn(1074).MessageStates;
const size = fn(2);
const result = size.fileFinishedImporting("modules/messages/useOnMessageSend.tsx");
2026-07-20 16:05:17 +00:00
export default function useOnMessageSend(arg0) {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
dependencyMap = tmp;
2026-07-20 16:05:17 +00:00
const items = [arg0, arg1];
const effect = noop.useEffect(() => {
2026-07-20 16:05:17 +00:00
function handleMessage(channelId) {
2026-07-29 08:29:29 +00:00
let tmp2 = undefined !== handleMessageCreate;
if (tmp2) {
tmp2 = channelId.channelId !== tmp;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (!tmp2) {
2026-07-20 16:05:17 +00:00
handleMessage();
}
}
function handleMessageCreate(optimistic) {
optimistic = optimistic.optimistic;
if (!optimistic) {
optimistic = optimistic.message.state === constants.SENDING;
2026-07-20 16:05:17 +00:00
}
if (optimistic) {
2026-07-29 08:29:29 +00:00
if (!tmp3) {
handleMessage();
}
tmp3 = undefined !== handleMessageCreate && optimistic.channelId !== tmp2;
2026-07-20 16:05:17 +00:00
}
}
const subscription = closure_0(573).subscribe("MESSAGE_CREATE", handleMessageCreate);
let obj = closure_0(573);
const subscription1 = closure_0(573).subscribe("UPLOAD_START", handleMessage);
let obj2 = closure_0(573);
const subscription2 = closure_0(573).subscribe("CALL_CREATE", handleMessage);
2026-07-20 16:05:17 +00:00
return () => {
DispatcherDefault.unsubscribe("MESSAGE_CREATE", handleMessageCreate);
DispatcherDefault.unsubscribe("UPLOAD_START", handleMessage);
DispatcherDefault.unsubscribe("CALL_CREATE", handleMessage);
2026-07-20 16:05:17 +00:00
};
}, items);
};