aboutsummaryrefslogtreecommitdiffstats
path: root/public/js/calculator.coffee
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2014-07-22 14:42:18 -0700
committerAdam Soltys <[email protected]>2014-07-22 14:42:18 -0700
commiteb75029273e477a6ed4486d204a19ee762af07bf (patch)
tree83fd2668aeed750740e241cdd79184ed970de20c /public/js/calculator.coffee
parentcf38dbcfd494eec9bc479845d918f1354197321f (diff)
downloadcoinos-server-eb75029273e477a6ed4486d204a19ee762af07bf.tar.gz
coinos-server-eb75029273e477a6ed4486d204a19ee762af07bf.zip
Display connection status icon
Diffstat (limited to 'public/js/calculator.coffee')
-rw-r--r--public/js/calculator.coffee8
1 files changed, 6 insertions, 2 deletions
diff --git a/public/js/calculator.coffee b/public/js/calculator.coffee
index f035855e..48e14764 100644
--- a/public/js/calculator.coffee
+++ b/public/js/calculator.coffee
@@ -92,7 +92,7 @@ setup = ->
$('#currency').html(g.currency)
$('#received').hide()
- # setupSocket()
+ setupSocket()
fetchExchangeRate()
fetchExchangeRate = ->
@@ -126,14 +126,18 @@ setupSocket = ->
g.websocket = new WebSocket("wss://ws.blockchain.info/inv")
g.websocket.onopen = ->
+ $('#connection').fadeIn().removeClass('glyphicon-exclamation-sign').addClass('glyphicon-signal')
g.websocket.send('{"op":"addr_sub", "addr":"' + g.address + '"}')
g.websocket.onerror = ->
+ $('#connection').addClass('glyphicon-exclamation-sign').removeClass('glyphicon-signal')
g.websocket = null
fail(SOCKET_FAIL)
g.websocket.onclose = ->
- setupSocket()
+ $('#connection').addClass('glyphicon-exclamation-sign').removeClass('glyphicon-signal')
+ g.websocket = null
+ fail(SOCKET_FAIL)
g.websocket.onmessage = (e) ->
results = eval('(' + e.data + ')')