Only show ajax spinner if data is sent. Disabled spinner for long polling.

This commit is contained in:
Martin Edenhofer 2012-11-27 19:58:00 +01:00
parent 5ac6c06dc2
commit 09864f330e
2 changed files with 23 additions and 8 deletions

View file

@ -92,3 +92,6 @@ class _Singleton
if @count == 0
$('.spinner').hide()
else if App.WebSocket.channel() is 'ajax'
if @count == 1
$('.spinner').hide()

View file

@ -7,20 +7,29 @@ class App.WebSocket
_instance ?= new _Singleton
_instance
@close: (args) -> # Must be a static method
if _instance isnt undefined
_instance.close(args)
@close: (args) ->
if _instance == undefined
_instance ?= new _Singleton
_instance.close(args)
@send: (args) -> # Must be a static method
@connect()
@send: (args) ->
if _instance == undefined
_instance ?= new _Singleton
_instance.send(args)
@auth: (args) -> # Must be a static method
@connect()
@auth: (args) ->
if _instance == undefined
_instance ?= new _Singleton
_instance.auth(args)
@channel: ->
if _instance == undefined
_instance ?= new _Singleton
_instance.channel()
@_spool: ->
@connect()
if _instance == undefined
_instance ?= new _Singleton
_instance.spool()
# The actual Singleton class
@ -49,6 +58,9 @@ class _Singleton extends App.Controller
# inital connect
@connect()
channel: ->
@backend
send: (data) =>
if @backend is 'ajax'
@_ajaxSend(data)