pubnub isTyping status Ionic2

吃可爱长大的小学妹 提交于 2019-12-14 03:48:17

问题


I've implemented a chat using Ionic2 with pubnub, the thing is how can I implement the isTyping to show it on my html? I know I have to create a state on my user, but I don't know how to update it.

My pubnub service have differents methods, and I thought I could add a PubNubEventType that it's called TYPING but I don't know how to update it from my component (where I have the chat implemented)

This is my component...

Any ideas?


回答1:


PubNub - using setState for isTyping

You just need to capture key press event to set state true and after a few seconds of no key press events or after publish (send button click), set state false. You set the state using this. pubNubService.setState(...) API.

The key press events part is purely JS/Iconic and not PubNub specific so I will leave that to someone else to provide insights.

This is an older blog but it demonstrates this very well.



来源:https://stackoverflow.com/questions/44945992/pubnub-istyping-status-ionic2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!