Small code cleanup.
This commit is contained in:
parent
1c1dd25832
commit
bca84d7968
1 changed files with 8 additions and 8 deletions
|
@ -63,7 +63,8 @@ do($ = window.jQuery, window) ->
|
||||||
|
|
||||||
@ws.onopen = =>
|
@ws.onopen = =>
|
||||||
console.log('ws connected')
|
console.log('ws connected')
|
||||||
@send 'chat_status'
|
@send 'chat_status_customer'
|
||||||
|
|
||||||
|
|
||||||
@ws.onmessage = @onWebSocketMessage
|
@ws.onmessage = @onWebSocketMessage
|
||||||
|
|
||||||
|
@ -97,11 +98,6 @@ do($ = window.jQuery, window) ->
|
||||||
when 'chat_session_typing'
|
when 'chat_session_typing'
|
||||||
return if pipe.data.self_written
|
return if pipe.data.self_written
|
||||||
@onAgentTypingStart()
|
@onAgentTypingStart()
|
||||||
if @stopTypingId
|
|
||||||
clearTimeout(@stopTypingId)
|
|
||||||
delay = =>
|
|
||||||
@onAgentTypingEnd()
|
|
||||||
@stopTypingId = setTimeout(delay, 3000)
|
|
||||||
when 'chat_session_start'
|
when 'chat_session_start'
|
||||||
switch pipe.data.state
|
switch pipe.data.state
|
||||||
when 'ok'
|
when 'ok'
|
||||||
|
@ -113,7 +109,7 @@ do($ = window.jQuery, window) ->
|
||||||
when 'queue'
|
when 'queue'
|
||||||
@onQueue pipe.data.position
|
@onQueue pipe.data.position
|
||||||
@session_id = pipe.data.session_id
|
@session_id = pipe.data.session_id
|
||||||
when 'chat_status'
|
when 'chat_status_customer'
|
||||||
switch pipe.data.state
|
switch pipe.data.state
|
||||||
when 'online'
|
when 'online'
|
||||||
@onReady()
|
@onReady()
|
||||||
|
@ -245,6 +241,10 @@ do($ = window.jQuery, window) ->
|
||||||
position: position
|
position: position
|
||||||
|
|
||||||
onAgentTypingStart: =>
|
onAgentTypingStart: =>
|
||||||
|
if @stopTypingId
|
||||||
|
clearTimeout(@stopTypingId)
|
||||||
|
@stopTypingId = setTimeout(@onAgentTypingEnd, 3000)
|
||||||
|
|
||||||
# never display two typing indicators
|
# never display two typing indicators
|
||||||
return if @el.find('.zammad-chat-message--typing').size()
|
return if @el.find('.zammad-chat-message--typing').size()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue