From fa0281aeb122058fa7d353fcd74e08a6702a9061 Mon Sep 17 00:00:00 2001 From: Javan Makhmali Date: Thu, 25 Jun 2015 16:12:26 -0400 Subject: Cable.Channel -> Cable.Subscription --- lib/assets/javascripts/cable/channel.js.coffee | 22 ---------------------- .../javascripts/cable/subscription.js.coffee | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 22 deletions(-) delete mode 100644 lib/assets/javascripts/cable/channel.js.coffee create mode 100644 lib/assets/javascripts/cable/subscription.js.coffee (limited to 'lib/assets/javascripts/cable') diff --git a/lib/assets/javascripts/cable/channel.js.coffee b/lib/assets/javascripts/cable/channel.js.coffee deleted file mode 100644 index 9168a76d3c..0000000000 --- a/lib/assets/javascripts/cable/channel.js.coffee +++ /dev/null @@ -1,22 +0,0 @@ -class Cable.Channel - constructor: (@cable, params = {}, mixin) -> - @identifier = JSON.stringify(params) - extend(this, mixin) - @cable.subscribers.add(this) - - # Perform a channel action with the optional data passed as an attribute - perform: (action, data = {}) -> - data.action = action - @send(data) - - send: (data) -> - @cable.send(command: "message", identifier: @identifier, data: JSON.stringify(data)) - - unsubscribe: -> - @cable.subscribers.remove(this) - - extend = (object, properties) -> - if properties? - for key, value of properties - object[key] = value - object diff --git a/lib/assets/javascripts/cable/subscription.js.coffee b/lib/assets/javascripts/cable/subscription.js.coffee new file mode 100644 index 0000000000..8057ff7790 --- /dev/null +++ b/lib/assets/javascripts/cable/subscription.js.coffee @@ -0,0 +1,22 @@ +class Cable.Subscription + constructor: (@cable, params = {}, mixin) -> + @identifier = JSON.stringify(params) + extend(this, mixin) + @cable.subscribers.add(this) + + # Perform a channel action with the optional data passed as an attribute + perform: (action, data = {}) -> + data.action = action + @send(data) + + send: (data) -> + @cable.send(command: "message", identifier: @identifier, data: JSON.stringify(data)) + + unsubscribe: -> + @cable.subscribers.remove(this) + + extend = (object, properties) -> + if properties? + for key, value of properties + object[key] = value + object -- cgit v1.2.3