mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix location of default mount path value
#getConfig was implmented as general utility for reading action-cable-* meta tags (hence the `name` argument). Introduced in 8b69f1eeba
.
This commit is contained in:
parent
f8ec3a142f
commit
5e84b95578
1 changed files with 3 additions and 2 deletions
|
@ -4,12 +4,13 @@
|
|||
@ActionCable =
|
||||
INTERNAL: <%= ActionCable::INTERNAL.to_json %>
|
||||
|
||||
createConsumer: (url = @getConfig("url")) ->
|
||||
createConsumer: (url) ->
|
||||
url ?= @getConfig("url") ? "/cable"
|
||||
new ActionCable.Consumer @createWebSocketURL(url)
|
||||
|
||||
getConfig: (name) ->
|
||||
element = document.head.querySelector("meta[name='action-cable-#{name}']")
|
||||
element?.getAttribute("content") ? '/cable'
|
||||
element?.getAttribute("content")
|
||||
|
||||
createWebSocketURL: (url) ->
|
||||
if url and not /^wss?:/i.test(url)
|
||||
|
|
Loading…
Reference in a new issue