Skip to content

Commit

Permalink
fix (WebBridge) don't poll for client updates in composer2 web app
Browse files Browse the repository at this point in the history
  • Loading branch information
christofferh committed Jun 30, 2016
1 parent ebf4ec9 commit 40a9af4
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/bridges/WebBridge.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ class WebBridge extends Bridge
window.AG_SCREEN_ID = 0
window.AG_LAYER_ID = 0
window.AG_VIEW_ID = 0
@registerForClientRefresh()
@

@isUsable: ()->
return navigator.userAgent.indexOf("AppGyverSteroids") == -1

registerForClientRefresh: ->
# Don't poll for refresh if we're not in localhost (e.g. Composer2 web app).
return if window.location.hostname isnt "localhost"

refresh =
id: null
Expand Down Expand Up @@ -41,11 +50,6 @@ class WebBridge extends Bridge

refresh.id = setInterval pollForRefresh, 1000

return @

@isUsable: ()->
return navigator.userAgent.indexOf("AppGyverSteroids") == -1

sendMessageToNative:(messageString)->
message = JSON.parse(messageString)

Expand Down

0 comments on commit 40a9af4

Please sign in to comment.