For my project I needed to prevent add the "fake" message with the "send" button until the "real" message had been created in the server.
I want to you check if you can fix/analize this subject.
You have any idea/alternative of how to solve that problem without this? (code below)
*I like to understand more how works the Live options, can you add some tips more in the Docs, please.
`
function addMessage(_message, handled) {
if (!handled) {
that.messages.push(_message);
}
}
function replaceLastMessage(_message, handled) {
if (!handled) {
that.messages[that.messages.length - 1] = _message;
}
}
var _message = {
...
};
var handled = null;
...
if (!resetLiveLastMessageReference) {
handled = that.sendFunction(_message);
}
if (that.options.liveMode && !resetLiveLastMessageReference) {
if (that.messages.length === 0) {
addMessage(_message, handled);
} else {
if (that.rawmessage.length === 1) {
addMessage(_message, handled);
} else {
replaceLastMessage(_message, handled);
}
}
}
For my project I needed to prevent add the "fake" message with the "send" button until the "real" message had been created in the server. I want to you check if you can fix/analize this subject. You have any idea/alternative of how to solve that problem without this? (code below)
*I like to understand more how works the Live options, can you add some tips more in the Docs, please.
` function addMessage(_message, handled) { if (!handled) { that.messages.push(_message); } } function replaceLastMessage(_message, handled) { if (!handled) { that.messages[that.messages.length - 1] = _message; } }
... `