Facebook のような「xyz が入力中」機能を備えたチャットを作成したいと思います。
onKeydownSource.subscribe(function() {
var typing = true;
}.bind(this));
onKeydownSource.throttle(500).subscribe(function(e) {
var typing = false;
}.bind(this));
ユーザーが入力をやめたときに、このスニペットを使用して登録します。
e を想像してください。
{
userId: 13,
conversationId: 23
}
そして、私のストリーム/サブスクライバーは
onKeydownSource.subscribe(function(e) {
typingInConversations[e.conversationId][e.userId] = true;
}.bind(this));
onKeydownSource
// What should be here?
.subscribe(function(e) {
typingInConversations[e.conversationId][e.userId] = false;
}.bind(this));
これは、ユーザーとユーザーが入力している会話を登録するすべてのキーダウンに対して意味します。