Skip to content

Instantly share code, notes, and snippets.

@naphatamity
Created January 6, 2023 07:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naphatamity/cb2ebc9e0720bc1e1e4548f2b615cba1 to your computer and use it in GitHub Desktop.
Save naphatamity/cb2ebc9e0720bc1e1e4548f2b615cba1 to your computer and use it in GitHub Desktop.
const channelItem = ({ channelid = "channelid" }) => {
useEffect(() => {
console.log("observeMessages");
observeMessages(channelid, {
onEvent: (action, message) => {
console.log("message OBserver Callds,ld,s>?:::::::");
if (action === "onCreate") {
console.log("message>?:::::::", JSON.stringify(message), action);
//dispatch({notifyOnNewMessageSent(message.data)});
if (message.data?.type == "image" && message.data?.editedAt) {
console.log("message.data?.type == image", JSON.stringify(message));
} else if (message.data?.type !== "image" && message.data?.editedAt) {
console.log(
"message.data?.type !== image",
JSON.stringify(message)
);
}
console.log("DONE", JSON.stringify(message));
}
},
});
}, [channelid]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment