decord/beta/source/modules/messages/useOnMessageSend.tsx

114 lines
3.7 KiB
TypeScript
Raw Permalink Normal View History

2026-10-12 16:32:48 +00:00
// Module ID: 17518
// Function ID: 17519
// Name: useOnMessageSend
2026-10-07 22:43:51 +00:00
// Dependencies: [19, 1085, 558, 576, 584, 2]
2026-10-12 16:32:48 +00:00
// Module 17518 (useOnMessageSend)
2026-10-07 22:43:51 +00:00
import DispatcherDefault from "Dispatcher" /* 584 */;
import Constants from "Constants" /* 1085 */;
2026-10-01 14:13:23 +00:00
import react from "react" /* 19 */;
2026-10-02 13:37:24 +00:00
import ReactCompilerGating from "ReactCompilerGating" /* 558 */;
2026-10-01 14:13:23 +00:00
import size from "module_2" /* 2 */;
2026-10-02 13:37:24 +00:00
const require = globalThis.__r;
let _require;
2026-10-02 13:37:24 +00:00
const MessageStates = Constants.MessageStates;
2026-10-12 16:32:48 +00:00
let tmp2 = ReactCompilerGating.isReactCompilerEnabled() ? (function useOnMessageSend(arg0, arg1) {
2026-10-02 13:37:24 +00:00
let closure_0;
_require = arg0;
let obj = require("react");
const cResult = obj.c(4);
let tmp2;
if (undefined !== arg1) {
tmp2 = arg1;
}
let closure_1 = tmp2;
if (cResult[0] === arg0) {
let tmp3;
let tmp4;
if (cResult[1] === tmp2) {
tmp3 = cResult[2];
tmp4 = cResult[3];
}
const effect = react.useEffect(tmp3, tmp4);
}
const fn = function c() {
function handleMessage(channelId) {
const tmp2 = undefined !== handleMessageCreate && channelId.channelId !== tmp;
if (!tmp2) {
handleMessage();
}
}
function handleMessageCreate(optimistic) {
optimistic = optimistic.optimistic || optimistic.message.state === constants.SENDING;
if (optimistic) {
const tmp3 = undefined !== handleMessageCreate && optimistic.channelId !== tmp2;
if (!tmp3) {
handleMessage();
}
}
}
let obj = closure_1(dependencyMap[4]);
const subscription = obj.subscribe("MESSAGE_CREATE", handleMessageCreate);
let obj2 = closure_1(dependencyMap[4]);
const subscription1 = obj2.subscribe("UPLOAD_START", handleMessage);
let obj3 = closure_1(dependencyMap[4]);
const subscription2 = obj3.subscribe("CALL_CREATE", handleMessage);
return () => {
const obj = DispatcherDefault;
obj.unsubscribe("MESSAGE_CREATE", handleMessageCreate);
const obj2 = DispatcherDefault;
obj2.unsubscribe("UPLOAD_START", handleMessage);
const obj3 = DispatcherDefault;
obj3.unsubscribe("CALL_CREATE", handleMessage);
};
};
const items = [arg0, tmp2];
cResult[0] = arg0;
cResult[1] = tmp2;
cResult[2] = fn;
cResult[3] = items;
tmp4 = items;
tmp3 = fn;
2026-10-12 16:32:48 +00:00
}) : (function useOnMessageSend(arg0) {
2026-10-01 14:13:23 +00:00
let closure_0 = arg0;
const tmp = arg1;
let closure_1 = tmp;
const items = [arg0, tmp];
const effect = react.useEffect(() => {
function handleMessage(channelId) {
2026-10-01 14:13:23 +00:00
const tmp2 = undefined !== handleMessageCreate && channelId.channelId !== tmp;
if (!tmp2) {
handleMessage();
}
}
function handleMessageCreate(optimistic) {
2026-10-01 14:13:23 +00:00
optimistic = optimistic.optimistic || optimistic.message.state === constants.SENDING;
if (optimistic) {
2026-10-01 14:13:23 +00:00
const tmp3 = undefined !== handleMessageCreate && optimistic.channelId !== tmp2;
if (!tmp3) {
handleMessage();
}
}
}
2026-10-02 13:37:24 +00:00
let obj = closure_1(dependencyMap[4]);
2026-10-01 14:13:23 +00:00
const subscription = obj.subscribe("MESSAGE_CREATE", handleMessageCreate);
2026-10-02 13:37:24 +00:00
let obj2 = closure_1(dependencyMap[4]);
2026-10-01 14:13:23 +00:00
const subscription1 = obj2.subscribe("UPLOAD_START", handleMessage);
2026-10-02 13:37:24 +00:00
let obj3 = closure_1(dependencyMap[4]);
2026-10-01 14:13:23 +00:00
const subscription2 = obj3.subscribe("CALL_CREATE", handleMessage);
return () => {
2026-10-01 14:13:23 +00:00
const obj = DispatcherDefault;
obj.unsubscribe("MESSAGE_CREATE", handleMessageCreate);
const obj2 = DispatcherDefault;
obj2.unsubscribe("UPLOAD_START", handleMessage);
const obj3 = DispatcherDefault;
obj3.unsubscribe("CALL_CREATE", handleMessage);
};
}, items);
2026-10-02 13:37:24 +00:00
});
const result = size.fileFinishedImporting("modules/messages/useOnMessageSend.tsx");
export default tmp2;