dont send typing notif on each keyup

This commit is contained in:
barisusakli
2014-09-02 14:29:22 -04:00
parent 26c0b097cf
commit 625766ba85
2 changed files with 12 additions and 8 deletions

View File

@@ -49,11 +49,13 @@ define('forum/chats', ['string', 'sounds'], function(S, sounds) {
});
inputEl.on('keyup', function() {
if ($(this).val()) {
Chats.notifyTyping(Chats.getRecipientUid(), true);
} else {
Chats.notifyTyping(Chats.getRecipientUid(), false);
var val = !!$(this).val();
if ((val && $(this).attr('data-typing') === 'true') || (!val && $(this).attr('data-typing') === 'false')) {
return;
}
Chats.notifyTyping(Chats.getRecipientUid(), val);
$(this).attr('data-typing', val);
});
sendEl.on('click', function(e) {