aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/app/assets/javascripts/action_cable.coffee.erb
diff options
context:
space:
mode:
authorRichard Macklin <richard.github@nrm.com>2017-12-11 14:29:45 +0800
committerRichard Macklin <richard.github@nrm.com>2018-11-02 08:40:10 -0700
commit7b0b37240a20c74197408ac3b53519e7e18347e9 (patch)
tree6c8a466021ac63a990480eea430bb6b016cd2c92 /actioncable/app/assets/javascripts/action_cable.coffee.erb
parentd80925b169f0db950697868f5659a67cc03e8654 (diff)
downloadrails-7b0b37240a20c74197408ac3b53519e7e18347e9.tar.gz
rails-7b0b37240a20c74197408ac3b53519e7e18347e9.tar.bz2
rails-7b0b37240a20c74197408ac3b53519e7e18347e9.zip
Move actioncable javascript to app/javascript and change .coffee -> .js
- Rename action_cable/*.coffee -> *.js - Move app/assets/javascripts/* -> app/javascript/* - Rename action_cable.js.erb -> action_cable/index.js.erb Renaming the extension to .js is in preparation for converting these files from coffeescript to ES2015. Moving the files to app/javascript and putting the entry point in index.js.erb changes the structure of ActionCable's javascript to match the structure of ActiveStorage's javascript. (We are doing the file moving and renaming in a separate commit to ensure that the git history of the files will be preserved - i.e. git will track these as file renames rather than unrelated file additions/deletions. In particular, git blame will still trace back to the original authorship.)
Diffstat (limited to 'actioncable/app/assets/javascripts/action_cable.coffee.erb')
-rw-r--r--actioncable/app/assets/javascripts/action_cable.coffee.erb38
1 files changed, 0 insertions, 38 deletions
diff --git a/actioncable/app/assets/javascripts/action_cable.coffee.erb b/actioncable/app/assets/javascripts/action_cable.coffee.erb
deleted file mode 100644
index e0758dae72..0000000000
--- a/actioncable/app/assets/javascripts/action_cable.coffee.erb
+++ /dev/null
@@ -1,38 +0,0 @@
-#= export ActionCable
-#= require_self
-#= require ./action_cable/consumer
-
-@ActionCable =
- INTERNAL: <%= ActionCable::INTERNAL.to_json %>
- WebSocket: window.WebSocket
- logger: window.console
-
- createConsumer: (url) ->
- url ?= @getConfig("url") ? @INTERNAL.default_mount_path
- new ActionCable.Consumer @createWebSocketURL(url)
-
- getConfig: (name) ->
- element = document.head.querySelector("meta[name='action-cable-#{name}']")
- element?.getAttribute("content")
-
- createWebSocketURL: (url) ->
- if url and not /^wss?:/i.test(url)
- a = document.createElement("a")
- a.href = url
- # Fix populating Location properties in IE. Otherwise, protocol will be blank.
- a.href = a.href
- a.protocol = a.protocol.replace("http", "ws")
- a.href
- else
- url
-
- startDebugging: ->
- @debugging = true
-
- stopDebugging: ->
- @debugging = null
-
- log: (messages...) ->
- if @debugging
- messages.push(Date.now())
- @logger.log("[ActionCable]", messages...)