catch pusher unsubscribe exceptions

This commit is contained in:
Sven Fuchs 2012-09-26 21:43:56 +02:00
parent b33f4d88aa
commit 060812b65d
2 changed files with 5 additions and 3 deletions

View File

@ -13,13 +13,15 @@ $.extend Travis.Pusher.prototype,
subscribe: (channel) ->
if @pusher && @active_channels.indexOf(channel) == -1
@active_channels.push(channel)
@pusher.subscribe(@prefix(channel)).bind_all (event, data) => @receive(event, data)
@pusher.subscribe(@prefix(channel)).bind_all(event, data) => @receive(event, data)
unsubscribe: (channel) ->
ix = @active_channels.indexOf(channel)
if @pusher && ix == -1
@active_channels.splice(ix, 1)
@pusher.unsubscribe(@prefix(channel))
try
@pusher.unsubscribe(@prefix(channel))
catch e
prefix: (channel) ->
"#{Travis.Pusher.CHANNEL_PREFIX}#{channel}"

File diff suppressed because one or more lines are too long