Pull current online message after new web socket connection has been established.

This commit is contained in:
Martin Edenhofer 2015-08-31 10:56:00 +02:00
parent 31ab7a195f
commit afa974a5da

View file

@ -5,13 +5,25 @@ class App.OnlineNotificationWidget extends App.Controller
constructor: ->
super
# at runtime if a online notifiction has changed
@bind 'OnlineNotification::changed', =>
@delay(
=> @fetch()
1200
1600
'online-notification-changed'
)
# after new websocket connection has been established
@ignoreInitLogin = false
@bind 'ws:login', =>
if @ignoreInitLogin
@delay(
=> @fetch()
3200
'online-notification-changed'
)
@ignoreInitLogin = true
# rebuild widget on auth
@bind 'auth', (user) =>
if !user