A chat input widget that can track typing states, and handle editing previous messages.
$ npm install otalk-chat-input-view
var ChatInputView = require('otalk-chat-input-view');
var client = SomeRealtimeConnection();
var peer = SomeContactModel();
var view = new ChatInputView({
sendChat: function (body, prevID) {
client.sendChat({
to: peer.id,
body: body,
replace: prevID
});
},
sendChatState: function (state) {
client.sendChatState({
to: peer.id,
chatState: state
});
},
previousMessage: function () {
return {
id: peer.lastSentMessage.id,
body: peer.lastSentMessage.body
};
}
});
MIT
If you like this, follow @lancestout on twitter.