2.0.0 • Published 8 years ago
otalk-chat-input-view v2.0.0
otalk-chat-input-view
A chat input widget that can track typing states, and handle editing previous messages.
Installing
$ npm install otalk-chat-input-view
Using
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
};
}
});
License
MIT
Created By
If you like this, follow @lancestout on twitter.