提交 5e84b955 编写于 作者: J Javan Makhmali

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 8b69f1ee.
上级 f8ec3a14
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册