diff options
Diffstat (limited to 'actioncable/app')
-rw-r--r-- | actioncable/app/assets/javascripts/action_cable/subscriptions.coffee | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/actioncable/app/assets/javascripts/action_cable/subscriptions.coffee b/actioncable/app/assets/javascripts/action_cable/subscriptions.coffee index d3ce67135d..aa052bf5d8 100644 --- a/actioncable/app/assets/javascripts/action_cable/subscriptions.coffee +++ b/actioncable/app/assets/javascripts/action_cable/subscriptions.coffee @@ -16,8 +16,6 @@ class ActionCable.Subscriptions subscription = new ActionCable.Subscription @consumer, params, mixin @add(subscription) - subscription - # Private add: (subscription) -> @@ -25,20 +23,23 @@ class ActionCable.Subscriptions @consumer.ensureActiveConnection() @notify(subscription, "initialized") @sendCommand(subscription, "subscribe") + subscription remove: (subscription) -> @forget(subscription) - unless @findAll(subscription.identifier).length @sendCommand(subscription, "unsubscribe") + subscription reject: (identifier) -> for subscription in @findAll(identifier) @forget(subscription) @notify(subscription, "rejected") + subscription forget: (subscription) -> @subscriptions = (s for s in @subscriptions when s isnt subscription) + subscription findAll: (identifier) -> s for s in @subscriptions when s.identifier is identifier |