aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/lib/assets/javascripts/cable.coffee.erb
blob: 25a9fc79c278f2ad7a5c426491cfd5fe66db903d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
#= require_self
#= require cable/consumer

@Cable =
  INTERNAL: <%= ActionCable::INTERNAL.to_json %>

  createConsumer: (url = @getConfig("url")) ->
    new Cable.Consumer url

  getConfig: (name) ->
    element = document.head.querySelector("meta[name='action-cable-#{name}']")
    element?.getAttribute("content")