ajay chaudhary

Joined on Oct 7th 2017
Karma

1

  • var timeout;

    function timeoutFunction() {
    typing = false;
    socket.emit("typing", false);
    }

    $('.typing-message').keyup(function() {
    typing = true;
    socket.emit('startTyping', 'typing...');
    clearTimeout(timeout);
    timeout = setTimeout(timeoutFunction, 3000);
    });

    socket.on('startTyping', function(data) {
    if (data) {
    $('.typing').html(data);
    } else {
    $('.typing').html("");
    }
    });