MCPcopy
hub / github.com/socketio/socket.io / updateTyping

Function updateTyping

examples/cluster-httpd/server/public/main.js:153–170  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

151
152 // Updates the typing event
153 function updateTyping () {
154 if (connected) {
155 if (!typing) {
156 typing = true;
157 socket.emit('typing');
158 }
159 lastTypingTime = (new Date()).getTime();
160
161 setTimeout(function () {
162 var typingTimer = (new Date()).getTime();
163 var timeDiff = typingTimer - lastTypingTime;
164 if (timeDiff >= TYPING_TIMER_LENGTH && typing) {
165 socket.emit('stop typing');
166 typing = false;
167 }
168 }, TYPING_TIMER_LENGTH);
169 }
170 }
171
172 // Gets the 'X is typing' messages of a user
173 function getTypingMessages (data) {

Callers 1

main.jsFile · 0.70

Calls 1

emitMethod · 0.65

Tested by

no test coverage detected