aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJavan Makhmali <javan@javan.us>2016-03-04 10:32:43 -0500
committerJavan Makhmali <javan@javan.us>2016-03-04 10:34:24 -0500
commit1d5f80c7586169129c83316f8a968858123be76a (patch)
treed451cf3ae69d006e8082cbfd997b0731a9fb130a
parent7fe67bb67ace2e6e5dc372af33bdb2177106d985 (diff)
downloadrails-1d5f80c7586169129c83316f8a968858123be76a.tar.gz
rails-1d5f80c7586169129c83316f8a968858123be76a.tar.bz2
rails-1d5f80c7586169129c83316f8a968858123be76a.zip
Return subscription object(s) when updating the collection
-rw-r--r--actioncable/app/assets/javascripts/action_cable/subscriptions.coffee7
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