try simplifying pusher channel subscriptions
This commit is contained in:
parent
f827c155f5
commit
aa286866a8
|
@ -19,25 +19,22 @@ $.extend Travis.Pusher.prototype,
|
||||||
@callbacksToProcess = []
|
@callbacksToProcess = []
|
||||||
|
|
||||||
Visibility.change (e, state) =>
|
Visibility.change (e, state) =>
|
||||||
if state == 'visible'
|
@processSavedCallbacks() if state == 'visible'
|
||||||
@processSavedCallbacks()
|
|
||||||
|
|
||||||
setInterval @processSavedCallbacks.bind(this), @processingIntervalWhenHidden
|
setInterval @processSavedCallbacks.bind(this), @processingIntervalWhenHidden
|
||||||
|
|
||||||
subscribeAll: (channels) ->
|
subscribeAll: (channels) ->
|
||||||
for channel in channels
|
@subscribe(channel) for channel in channels
|
||||||
name = @prefix(channel)
|
|
||||||
channel = @pusher.subscribe(channel)
|
|
||||||
channel.bind_all((event, data) => @receive(event, data))
|
|
||||||
|
|
||||||
subscribe: (channel) ->
|
subscribe: (channel) ->
|
||||||
console.log("subscribing to #{channel}")
|
|
||||||
channel = @prefix(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) ->
|
unsubscribe: (channel) ->
|
||||||
console.log("unsubscribing from #{channel}")
|
|
||||||
channel = @prefix(channel)
|
channel = @prefix(channel)
|
||||||
|
console.log("unsubscribing from #{channel}")
|
||||||
@pusher.unsubscribe(channel) if @pusher?.channel(channel)
|
@pusher.unsubscribe(channel) if @pusher?.channel(channel)
|
||||||
|
|
||||||
prefix: (channel) ->
|
prefix: (channel) ->
|
||||||
|
|
Loading…
Reference in New Issue
Block a user