otalk-chat-input-view

2.0.0 • Public • Published

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.

Readme

Keywords

none

Package Sidebar

Install

npm i otalk-chat-input-view

Weekly Downloads

1

Version

2.0.0

License

MIT

Last publish

Collaborators

  • lancestout