aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/app/javascript/action_cable/index.js
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2019-01-14 15:24:26 -0500
committerGitHub <noreply@github.com>2019-01-14 15:24:26 -0500
commit0ffafd475bf4dbc2d0d30b0f06c99af9fbe22f01 (patch)
tree5895c7d9c1e42b6e0161cdb28dfb2e6273770730 /actioncable/app/javascript/action_cable/index.js
parent54d4a518d9a8079c9bc03bee454e966e93036942 (diff)
parent739f88e52ec9d673e23f41545d55626351ce24eb (diff)
downloadrails-0ffafd475bf4dbc2d0d30b0f06c99af9fbe22f01.tar.gz
rails-0ffafd475bf4dbc2d0d30b0f06c99af9fbe22f01.tar.bz2
rails-0ffafd475bf4dbc2d0d30b0f06c99af9fbe22f01.zip
Merge pull request #34934 from rmacklin/simplify-actioncable-methods-after-decaffeination
Clean up ActionCable JS a bit more after the CoffeeScript conversion
Diffstat (limited to 'actioncable/app/javascript/action_cable/index.js')
-rw-r--r--actioncable/app/javascript/action_cable/index.js10
1 files changed, 4 insertions, 6 deletions
diff --git a/actioncable/app/javascript/action_cable/index.js b/actioncable/app/javascript/action_cable/index.js
index 9f41c14e94..659418396f 100644
--- a/actioncable/app/javascript/action_cable/index.js
+++ b/actioncable/app/javascript/action_cable/index.js
@@ -18,17 +18,15 @@ export {
logger,
}
-export function createConsumer(url) {
- if (url == null) {
- const urlConfig = getConfig("url")
- url = (urlConfig ? urlConfig : INTERNAL.default_mount_path)
- }
+export function createConsumer(url = getConfig("url") || INTERNAL.default_mount_path) {
return new Consumer(createWebSocketURL(url))
}
export function getConfig(name) {
const element = document.head.querySelector(`meta[name='action-cable-${name}']`)
- return (element ? element.getAttribute("content") : undefined)
+ if (element) {
+ return element.getAttribute("content")
+ }
}
export function createWebSocketURL(url) {