From 1d5f80c7586169129c83316f8a968858123be76a Mon Sep 17 00:00:00 2001 From: Javan Makhmali Date: Fri, 4 Mar 2016 10:32:43 -0500 Subject: Return subscription object(s) when updating the collection --- .../app/assets/javascripts/action_cable/subscriptions.coffee | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'actioncable/app') 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 -- cgit v1.2.3