diff --git a/assets/scripts/app/pusher.coffee b/assets/scripts/app/pusher.coffee index efcaeb53..6c9927ec 100644 --- a/assets/scripts/app/pusher.coffee +++ b/assets/scripts/app/pusher.coffee @@ -19,25 +19,22 @@ $.extend Travis.Pusher.prototype, @callbacksToProcess = [] Visibility.change (e, state) => - if state == 'visible' - @processSavedCallbacks() + @processSavedCallbacks() if state == 'visible' setInterval @processSavedCallbacks.bind(this), @processingIntervalWhenHidden subscribeAll: (channels) -> - for channel in channels - name = @prefix(channel) - channel = @pusher.subscribe(channel) - channel.bind_all((event, data) => @receive(event, data)) + @subscribe(channel) for channel in channels subscribe: (channel) -> - console.log("subscribing to #{channel}") channel = @prefix(channel) - @pusher.subscribe(channel).bind_all((event, data) => @receive(event, data)) unless @pusher?.channel(channel) + console.log("subscribing to #{channel}") + unless @pusher?.channel(channel) + @pusher.subscribe(channel).bind_all((event, data) => @receive(event, data)) unsubscribe: (channel) -> - console.log("unsubscribing from #{channel}") channel = @prefix(channel) + console.log("unsubscribing from #{channel}") @pusher.unsubscribe(channel) if @pusher?.channel(channel) prefix: (channel) ->