pubnub isTyping status Ionic2 [英] pubnub isTyping status Ionic2
问题描述
我已经使用Ionic2与pubnub实现了聊天,问题是我如何实现 isTyping
以在我的 html上显示它
?我知道我必须在我的用户上创建州
,但我不知道如何更新它。
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.
我的 pubnub服务
有不同的方法,并且我以为我可以添加一个 PubNubEventType
,它叫做 TYPING
,但我不知道如何从我的组件更新它(我实施了聊天)
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
...
任何想法?
推荐答案
PubNub - 使用setState进行isTyping
您只需要捕获按键事件以设置状态为true并在几秒没有按键事件或发布后(发送按钮单击),设置状态为false。您可以使用此设置状态。 pubNubService.setState(...)API 。
关键新闻事件部分纯粹是JS / Iconic而不是PubNub特定所以我会将其留给其他人提供见解。
The key press events part is purely JS/Iconic and not PubNub specific so I will leave that to someone else to provide insights.
这是一个旧博客,但它演示了这很好。
这篇关于pubnub isTyping status Ionic2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!