diff options
author | Javan Makhmali <javan@javan.us> | 2016-03-04 10:32:43 -0500 |
---|---|---|
committer | Javan Makhmali <javan@javan.us> | 2016-03-04 10:34:24 -0500 |
commit | 1d5f80c7586169129c83316f8a968858123be76a (patch) | |
tree | d451cf3ae69d006e8082cbfd997b0731a9fb130a /actioncable | |
parent | 7fe67bb67ace2e6e5dc372af33bdb2177106d985 (diff) | |
download | rails-1d5f80c7586169129c83316f8a968858123be76a.tar.gz rails-1d5f80c7586169129c83316f8a968858123be76a.tar.bz2 rails-1d5f80c7586169129c83316f8a968858123be76a.zip |
Return subscription object(s) when updating the collection
Diffstat (limited to 'actioncable')
-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 |